日期:2014-05-17  浏览次数:20609 次

HTML获取一些有用的宽高值
alert("网页可见区域宽: document.body.clientWidth:"+document.body.clientWidth);
alert("网页可见区域高: document.body.clientHeight:"+document.body.clientHeight);
alert("网页可见区域宽: document.body.offsetWidth (包括边线的宽):"+document.body.offsetWidth);
alert("网页可见区域高: document.body.offsetHeight (包括边线的高):"+document.body.offsetHeight);
alert("网页正文全文宽: document.body.scrollWidth:"+document.body.scrollWidth);
alert("网页正文全文高: document.body.scrollHeight:"+document.body.scrollHeight);
alert("网页被卷去的高: document.body.scrollTop:"+document.body.scrollTop);
alert("网页被卷去的左: document.body.scrollLeft:"+document.body.scrollLeft);
alert("网页正文部分上: window.screenTop:"+window.screenTop);
alert("网页正文部分左: window.screenLeft:"+window.screenLeft);
alert("屏幕分辨率的高: window.screen.height:"+window.screen.height);
alert("屏幕分辨率的宽: window.screen.width:"+window.screen.width);
alert("屏幕可用工作区高度: window.screen.availHeight:"+window.screen.availHeight);
alert("屏幕可用工作区宽度:window.screen.availWidth:"+window.screen.availWidth);