JavaScript 之 getScrollHeight() 实例
function getScrollHeight() {
var maxDisplacement=0;
window.scrollTo(0,10000000);
if( typeof self.pageYOffset!='undefined' )
maxDisplacement=self.pageYOffset;
else if( document.compatMode && document.compatMode != 'BackCompat' )
maxDisplacement=document.documentElement.scrollTop ;
else if( document.body && typeof(document.body.scrollTop)!='undefined' )
maxDisplacement=document.body.scrollTop;
window.scrollTo(0,0);
return maxDisplacement;
}
window.onload=function(){
var h = getScrollHeight();
alert(h);
}