`
Johnny_GZ
  • 浏览: 176386 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

转:js获取各种高度

阅读更多

<script type="text/javascript">

var     s   =   " ";

document.documentElement.scrollTop 就是滚动条距离顶部的位置(可变)

document.documentElement.scrollLef 指滚动条距离左边的位置(可变)

s   +=   "\r\n<br>网页可见区域宽: "+   document.body.clientWidth;
s   +=   "\r\n<br>网页可见区域高: "+   document.body.clientHeight;
s   +=   "\r\n<br>网页可见区域宽: "+   document.body.offsetWidth     + "   (包括边线的宽) ";
s   +=   "\r\n<br>网页可见区域高: "+   document.body.offsetHeight   + "   (包括边线的宽) ";
s   +=   "\r\n<br>网页正文全文宽: "+   document.body.scrollWidth;
s   +=   "\r\n<br>网页正文全文高: "+   document.body.scrollHeight;
s   +=   "\r\n<br>网页被卷去的高: "+   document.body.scrollTop;
s   +=   "\r\n<br>网页被卷去的左: "+   document.body.scrollLeft;
s   +=   "\r\n<br>网页正文部分上: "+   window.screenTop;
s   +=   "\r\n<br>网页正文部分左: "+   window.screenLeft;
s   +=   "\r\n<br>屏幕分辨率的高: "+   window.screen.height;
s   +=   "\r\n<br>屏幕分辨率的宽: "+   window.screen.width;
s   +=   "\r\n<br>屏幕可用工作区高度: "+   window.screen.availHeight+" (去掉状态栏)";
s   +=   "\r\n<br>屏幕可用工作区宽度: "+   window.screen.availWidth;
//alert(s);
document.write(s);
</script>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics