js获取网页的各种长度

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

 

posted @ 2014-02-20 21:59  哎呦喂,我的小祖宗╰つ  阅读(898)  评论(0编辑  收藏  举报