JS获取屏幕各种高

 1 <script language="javascript">
 2         var h = "";
 3         h += " 网页可见区域宽:"+ document.body.clientWidth;
 4         h += " 网页可见区域高:"+ document.body.clientHeight;
 5         h += " 网页可见区域宽:"+ document.body.offsetWidth +" (包括边线和滚动条的宽)";
 6         h += " 网页可见区域高:"+ document.body.offsetHeight +" (包括边线的宽)";
 7         h += " 网页正文全文宽:"+ document.body.scrollWidth;
 8         h += " 网页正文全文高:"+ document.body.scrollHeight;
 9         h += " 网页被卷去的高:"+ document.body.scrollTop;
10         h += " 网页被卷去的左:"+ document.body.scrollLeft;
11         h += " 网页正文部分上:"+ window.screenTop;
12         h += " 网页正文部分左:"+ window.screenLeft;
13         h += " 屏幕分辨率的高:"+ window.screen.height;
14         h += " 屏幕分辨率的宽:"+ window.screen.width;
15         h += " 屏幕可用工作区高度:"+ window.screen.availHeight;
16         h += " 屏幕可用工作区宽度:"+ window.screen.availWidth;
17         h += " 你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色";
18         h += " 你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸";
19          alert(h);
20     </script>

 

posted @ 2016-07-17 02:06  陈小银  阅读(543)  评论(0编辑  收藏  举报