JavaScript 练手小技巧:HTML5 的 dialog 标签制作对话框_dialog html-CSDN博客
<dialog id="dialog">
<h2 align="center">修改</h2>
<input type="text" id="title1" placeholder="标题" value=""><p>
<input type="text" id="website1" placeholder="https://" value="https://"><p>
<center><button id="button_modify_confirm">确定</button> <button id="button_modify_cancel">取消</button></center>
</dialog>
Modal 模式可以按 ESC 关闭 dialog
menu_modify.addEventListener('click', function(){
menu.style.display = 'none';
dialog.showModal();
});
点击 dialog 外部区域关闭窗口
dialog.addEventListener("click", function(e){
if (e.target.nodeName.toLowerCase() == "dialog") {
this.close();
}
});
按钮关闭窗口
button_modify_cancel.addEventListener("click", function(e){
dialog.close();
});



![[晓丽紫]每日论文分享(有中文摘要,源码或项目地址)--机器人相关](https://img-blog.csdnimg.cn/direct/b55b7eec303f45c1a0661bd242900999.jpeg#pic_center)















