获取浏览器和设备的宽、高

/*获取设备及浏览器的等的高度和宽度  */
        var height1=window.screen.height;
        var width1=window.screen.width;

        var height2=window.screen.availHeight;
        var width2=window.screen.availWidth;

        var height3=window.screenTop;
        var left3=window.screenLeft;

        var height4=document.body.clientHeight;
        var width4=document.body.clientWidth;

        var height5=document.body.offsetHeight;
        var width5=document.body.offsetWidth;

        var height6=document.body.scrollHeight;
        var width6=document.body.scrollWidth;

        var height7=document.body.scrollTop;
        var left7=document.body.scrollLeft;




        document.write("屏幕的分辨率高度"+height1);
        document.write("<br/>屏幕分辨率宽度"+width1);

        document.write("<br/>屏幕可用工作区域高度"+height2);
        document.write("<br/>屏幕可用工作区域宽度"+width2);

        document.write("<br/>网页正文部分上"+height3);
        document.write("<br/>网页正文部分左"+left3);

        document.write("<br/>网页可见区域高度"+height4);
        document.write("<br/>网页可见区域宽度"+width4);

        document.write("<br/>网页可见区域高度包括边框"+height5);
        document.write("<br/>网页可见区域宽度包括边框"+width5);

        document.write("<br/>网页正文高度"+height6);
        document.write("<br/>网页正文宽度"+width6);

        document.write("<br/>网页被卷去的高"+height7);
        document.write("<br/>网页被卷去的左"+left7+"<br/>");

详细解释:

原文链接:http://blog.csdn.net/nikita1995/article/details/52063549

转载于:https://www.cnblogs.com/WQLong/p/8134175.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值