检测浏览器宽和高

检测浏览器宽和高


function GetInfo(){
var s = "";
    s += "\r\n网页可见区域宽clientWidth:"+ document.body.clientWidth;
    s += "\r\n网页可见区域高clientHeight:"+ document.body.clientHeight;
    s += "\r\n网页可见区域宽offsetWidth:"+ document.body.offsetWidth + " (包括边线和滚动条的宽)";
    s += "\r\n网页可见区域高offsetHeight:"+ document.body.offsetHeight + " (包括边线的宽)";
    s += "\r\n网页正文全文宽scrollWidth:"+ document.body.scrollWidth;
    s += "\r\n网页正文全文高scrollHeight:"+ document.body.scrollHeight;
    s += "\r\n网页被卷去的高(ff)scrollTop:"+ document.body.scrollTop;
    s += "\r\n网页被卷去的高(ie)scrollTop:"+ document.documentElement.scrollTop;
    s += "\r\n网页被卷去的左scrollLeft:"+ document.body.scrollLeft;
    s += "\r\n网页正文部分上screenTop:"+ window.screenTop;
    s += "\r\n网页正文部分左screenLeft:"+ window.screenLeft;
    s += "\r\n屏幕分辨率的高screen.height:"+ window.screen.height;
    s += "\r\n屏幕分辨率的宽screen.width:"+ window.screen.width;
    s += "\r\n屏幕可用工作区高度.screen.availHeight:"+ window.screen.availHeight;
    s += "\r\n屏幕可用工作区宽度screen.availWidth:"+ window.screen.availWidth;
    s += "\r\n你的屏幕设置是screen.colorDepth:"+ window.screen.colorDepth +" 位彩色";
    alert (s);
}

 



转载于:https://www.cnblogs.com/dean5277/archive/2012/08/19/2646264.html

你可能感兴趣的:(检测浏览器宽和高)