编辑下面的代码:【加编码】
<html> <body> <p>点击按钮显示或者关闭对话窗口。</p> <button onclick="showDialog()">显示对话窗口</button> <button onclick="closeDialog()">关闭对话窗口</button> <p><b>注意:</b> 目前只有Chrome Canary,Safari 6 浏览器支持 <dialog> 元素。</dialog></p> <dialog id="myDialog">这是一个对话窗口</dialog> <script> var x = document.getElementById("myDialog"); function showDialog() { x.show(); } function closeDialog() { x.close(); } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂