<!DOCTYPE html><html><head><meta charset="utf-8"><title>W3Cschool教程(w3cschool.cn)</title></head><body><p>点击按钮创建一个 DIALOG 元素。</p><button onclick="myFunction()">点我</button><p><b>注意:</b> 目前只有Chrome Canary,Safari 6 浏览器支持 <dialog> 元素。</p><script>function myFunction(){var x = document.createElement("DIALOG");var t = document.createTextNode("这是一个弹窗");x.setAttribute("open", "open");x.appendChild(t);document.body.appendChild(x);}</script></body></html>