87,909
社区成员
发帖
与我相关
我的任务
分享
var s = "";
s += "document.body.clientWidth:" + document.body.clientWidth;
s += "<br />document.documentElement.offsetWidth:" + document.documentElement.offsetWidth;
s += "<br />document.body.offsetWidth:" + document.body.offsetWidth;
s += "<br />document.body.scrollWidth:" + document.body.scrollWidth;
s += "<br />window.screen.width:" + window.screen.width;
s += "<br />window.screen.availWidth:" + window.screen.availWidth;
/*ScrollTop*/
function getScrollTop() {
var scrollPos = 0;
if (typeof window.pageYOffset != 'undefined') {
scrollPos = window.pageYOffset;
}
else if (typeof window.document.compatMode != 'undefined' &&
window.document.compatMode != 'BackCompat') {
scrollPos = window.document.documentElement.scrollTop;
}
else if (typeof window.document.body != 'undefined') {
scrollPos = window.document.body.scrollTop;
}
return scrollPos;
}
/*end ScrollTop*/
/*ScrollLeft*/
function getScrollLeft(){
var scrollPos =0;
if (typeof window.pageXOffset != 'undefined') {
scrollPos = window.pageXOffset;
}
else if (typeof window.document.compatMode != 'undefined' &&
window.document.compatMode != 'BackCompat') {
scrollPos = window.document.documentElement.scrollLeft;
}
else if (typeof window.document.body != 'undefined') {
scrollPos = window.document.body.scrollLeft;
}
return scrollPos;
}
/*end ScrollLeft*/