日期:2014-05-16  浏览次数:20368 次

js获取body或屏幕的宽度大集合

//【转】js获取body或屏幕的宽度大集合

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);

?

?

?

?

?

?

?

?

?

?

愤怒的jser--好东西大家分享

?