首页 > 代码库 > js得到当前窗口内的宽度和高度

js得到当前窗口内的宽度和高度

 1 <SCRIPT  LANGUAGE="JavaScript">   2 var    s  =  "网页可见区域宽:"+  document.body.clientWidth;   3 s  +=  "\r\n网页可见区域高:"+  document.body.clientHeight;   4 s  +=  "\r\n网页可见区域高:"+  document.body.offsetWeight  +"  (包括边线的宽)";   5 s  +=  "\r\n网页可见区域高:"+  document.body.offsetHeight  +"  (包括边线的宽)";   6 s  +=  "\r\n网页正文全文宽:"+  document.body.scrollWidth;   7 s  +=  "\r\n网页正文全文高:"+  document.body.scrollHeight;   8 s  +=  "\r\n网页被卷去的高:"+  document.body.scrollTop;   9 s  +=  "\r\n网页被卷去的左:"+  document.body.scrollLeft;  10 s  +=  "\r\n网页正文部分上:"+  window.screenTop;  11 s  +=  "\r\n网页正文部分左:"+  window.screenLeft;  12 s  +=  "\r\n屏幕分辨率的高:"+  window.screen.height;  13 s  +=  "\r\n屏幕分辨率的宽:"+  window.screen.width;  14 s  +=  "\r\n屏幕可用工作区高度:"+  window.screen.availHeight;  15 s  +=  "\r\n屏幕可用工作区宽度:"+  window.screen.availWidth;  16 alert(s);  17 </SCRIPT>

 

转载自http://blog.163.com/niuzai369@126/blog/static/37430915201031734726319/,感谢分享

js得到当前窗口内的宽度和高度