find page length

F

finerrecliner

is there a function in JavaScript to find the total height of your
page? this value should INCLUDE the unseen space you have to scroll
down to see.

The Ypageoffset function seems to be close to what i want. but 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.

any ideas? thanks.
 
A

ASM

(e-mail address removed) a écrit :
is there a function in JavaScript to find the total height of your
page? this value should INCLUDE the unseen space you have to scroll
down to see.

The Ypageoffset function seems to be close to what i want. but 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.

any ideas? thanks.

an anchor in bottom of page ?
 
S

Stephen Chalmers

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top