fi***********@gmail.com wrote:
i want
the value when the scroll bar is at the bottom of the page at load
time, instead of waiting for the user to scroll down themselves.
It sounds like you want to know the page's maximum displacement. If so,
this is the way that I have done it in the past.
Instead of calculating from a range of properties, it attempts to
scroll down 10 Megapixels, then it reads the actual displacement before
scrolling back to the top.
Call it on load or later:
<SCRIPT type='text/javascript'>
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(){alert(getScrollHeight())}
</SCRIPT>