xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool教程(w3cschool.cn)</title>
</head>
<body>
<p id="demo">单击按钮来显示这个窗口的高度和宽度(包括工具栏和滚动条)。</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
var w=window.outerWidth;
var h=window.outerHeight;
x=document.getElementById("demo");
x.innerHTML="Width: " + w + " Heigth: " + h;
}
</script>
</body>
</html>