现在的位置: 首页 > 综合 > 正文

JS取屏幕尺寸汇总

2012年09月10日 ⁄ 综合 ⁄ 共 830字 ⁄ 字号 评论关闭

原文:http://www.cnblogs.com/duck1218/archive/2011/07/20/2112252.html

var bodyWidth =document.body.clientWidth; //网页可见区域宽   

var bodyHeight =document.body.clientHeight; //网页可见区域高

var bodyWidthWithBorder =document.body.offsetWidth; //网页可见区域宽(包括边线的宽)

var bodyHeightWithBorder=document.body.offsetHeight; //网页可见区域高(包括边线的宽)

var bodyWidthWithScroll =document.body.scrollWidth; //网页正文全文宽

var bodyHeightWithScroll=document.body.scrollHeight; //网页正文全文高

var bodyTopHeight =document.body.scrollTop; //网页被卷去的上边距

var bodyLeftWidth =document.body.scrollLeft; //网页被卷去的左边距

var windowTopHeight =window.screenTop; //网页正文部分上边距

var windowLeftWidth =window.screenLeft; //网页正文部分左边距

var screenHeight =window.screen.height; //屏幕分辨率的高

var screenWidth =window.screen.width; //屏幕分辨率的宽

var screenAvailHeight =window.screen.availHeight; //屏幕可用工作区高度

var screenAvailWidth =window.screen.availWidth; //屏幕可用工作区宽度

在IE下的示意图:

 

抱歉!评论已关闭.