<!DOCTYPE html> <html> <body> <h1>Window 对象</h1> <h2>screenX 和 screenY 属性</h2> <button onclick="myFunction()">打开窗口</button> <p id="demo"></p> <script> function myFunction() { const myWin = window.open("", "", "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>