代码示例:(标识:jsck_win_innerheight_1)
<!DOCTYPE html>
<html>
<body>

<h1>Window 对象</h1>

<h2>innerWidth 和 innerHeight 属性</h2>

<p id="demo"></p>

<script>
let w = window.innerWidth;
let h = window.innerHeight;
document.getElementById("demo").innerHTML = "宽度:" + w + "<br>高度:" + h;
</script>

</body>
</html>
运行结果: