运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The HTML Dialog Object</h1> <h2>The open Property</h2> <p>Click the button to find out if the dialog window is open.</p> <button onclick="myFunction()">Try it</button> <dialog id="myDialog" open>This is an open dialog window</dialog> <p id="demo"></p> <script> function myFunction() { let x = document.getElementById("myDialog").open; document.getElementById("demo").innerHTML = x; } </script> </body> </html>