xxxxxxxxxx
<!DOCTYPE html>
<html>
<title>JavaScript Window - The Browser Object Model示例 - 基础教程(div.cn)</title>
<body onresize="myFunc()">
<p>调整窗口大小以显示此框架的高度和宽度:</p>
<p id="para"></p>
<script>
function myFunc() {
var w = window.innerWidth;
var h = window.innerHeight;
document.getElementById("para").innerHTML = "Width: " + w + "<br>Height: " + h;
}
</script>
</body>
</html>