运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Window Object</h1> <h2>The screenX and screenY Properties</h2> <button onclick="myFunction()">Open Window</button> <p id="demo"></p> <script> function myFunction() { const myWin = window.open("", "", "left=700, top=350, width=200, height=100"); let x = myWin.screenX; let y = myWin.screenY; document.getElementById("demo").innerHTML = "myWin.screenX= " + x + "<br>myWin.screenY= " + y; } </script> </body> </html>