<!DOCTYPE html> <html> <body> <h1>Window 对象</h1> <h2>innerWidth 和 innerHeight 属性</h2> <p id="demo"></p> <script> let w = innerWidth; let h = innerHeight; document.getElementById("demo").innerHTML = "宽度:" + w + "<br>高度:" + h; </script> </body> </html>