I've been trying to get the document's height (i.e. the total height including the part that is not visible) and only get the window height theses are some of the results I've got: var y = document.documentElement.clientHeight;/*window height*/ var z = document.documentElement.scrollHeight; /*window height*/ var a =document.documentElement.offsetHeight; /*0 in FF - window height in IE*/ var b= document.documentElement.scrollTop;/*0 in FF - 0 IE*/ var c= document.documentElement.scrollTop;/*0 in FF - 0 IE*/ I've searched in google for hours without any luck Any help will be much appreciated
following links will be useful... http://codylindley.com/webdev/295/javascript-get-page-height-with-scroll http://www.webmasterworld.com/forum91/3429.htm
I find that 'document.documentElement.scrollHeight' is actually a reliable getter of the full rendered page height. It never seemed to get confused with the window height in any of the browsers I tested, using a strict html doctype. Out of curiosity, I also tried using 'document.body.scrollHeight'. That failed only in Firefox (v3.5), which returned the window height.
I've used: 'document.documentElement.scrollHeight and get the window height both in FF and IE6, with a difference of about 20px
Just wondering if your actual page content is small and occupies less than the window height. In that case, yes - the scrollHeight will return the window height as a minimum; it won't return anything less than the window height. If you want to measure the height of such small page content, you might need to put it in a div wrapper and get the offsetHeight of the wrapper.
tnx FilmFiddler! I spent several hours on this issue and then I found this your post. It works! Thank you very much!