<!DOCTYPE html> <html> <body> <h1>Window 对象</h1> <h2>内外宽度和高度:</h2> <div id="demo"></div> <script> let text = "<p>innerWidth: " + window.innerWidth + "</p>" + "<p>innerHeight: " + window.innerHeight + "</p>" + "<p>outerWidth: " + window.outerWidth + "</p>" + "<p>outerHeight: " + window.outerHeight + "</p>"; document.getElementById("demo").innerHTML = text; </script> </body> </html>