如何得到任意大小的窗口的宽、高?

window.screen.width和window.screen.availWidth都是固定值。
但我要得到任意大小的窗口的宽、高。

---------------------------------------------------------------

在javascript中得到当前窗口的高和宽

 1<body><script language="JavaScript">   
 2var s = "";   
 3s += "\r\n网页可见区域宽:"+ document.body.clientWidth;   
 4s += "\r\n网页可见区域高:"+ document.body.clientHeight;   
 5s += "\r\n网页可见区域高:"+ document.body.offsetWeight +" (包括边线的宽)";   
 6s += "\r\n网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";   
 7s += "\r\n网页正文全文宽:"+ document.body.scrollWidth;   
 8s += "\r\n网页正文全文高:"+ document.body.scrollHeight;   
 9s += "\r\n网页被卷去的高:"+ document.body.scrollTop;   
10s += "\r\n网页被卷去的左:"+ document.body.scrollLeft;   
11s += "\r\n网页正文部分上:"+ window.screenTop;   
12s += "\r\n网页正文部分左:"+ window.screenLeft;   
13s += "\r\n屏幕分辨率的高:"+ window.screen.height;   
14s += "\r\n屏幕分辨率的宽:"+ window.screen.width;   
15s += "\r\n屏幕可用工作区高度:"+ window.screen.availHeight;   
16s += "\r\n屏幕可用工作区宽度:"+ window.screen.availWidth;   
17alert(s);   
18</script>   
19\---------------------------------------------------------------   
20  
21document.body.clientWidth   
22document.body.clientHeight</body>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus