[thelist] height of document (body) MORE ;)

kris krois kkrois at web.de
Mon Sep 29 05:24:55 CDT 2003


based on the experiment of Peter Paul Koch and the according article 
<http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/index.html> 
i did a script which get's the actual height of the body.
It tested and working on
WIN: IE6, NN6, NN7, Mozilla
MAC: IE5.5, NN6, Mozilla, Safari
doesn't work on WIN NN4, Opera

function getHeight() {
	if (document.body.scrollHeight && 
navigator.appVersion.indexOf("Win") != -1) {
	// body.scrollHeight gets the correct value on WIN IE6, but non on MAC
		}
	else if (document.documentElement.scrollHeight) {
		alert('documentElement.scrollHeight' + 
document.documentElement.scrollHeight);
		}
	else if (document.documentElement.offsetHeight) {
		alert('documentElement.offsetHeight' + 
document.documentElement.offsetHeight);
		}
	}

Thanks for help.
k r i s

ps: it works with both doctypes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"> and
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">





>>At 07:50 28/09/2003, you wrote
>>>Hi,
>>>how can i get the height of a page with javaScript? Naturally for 
>>>all browsers (not necessarily NN4).
>>>Thanx,
>>>k r i s
>>
>>http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=16
>>
>>looks good, any good?
>
>i took a quick look at it. It seems to be helpful - i'll test it later.
>Thanks,
>k r i s
>
>
>
>>
>>John
>>java-script-world at yahoogroups.com
>>
>>--
>>* * Please support the community that supports you.  * *
>>http://evolt.org/help_support_evolt/
>>
>>For unsubscribe and other options, including the Tip Harvester and 
>>archives of thelist go to: http://lists.evolt.org Workers of the 
>>Web, evolt !
>
>
>--
>
>/
>\ kris krois
>/ gestaltung
>\
>/ kris at phlux.org
>\ phon +49 - (0)89 - 90 93 63-55
>/ cell +49 - (0)174 - 746 37 39
>\
>--
>* * Please support the community that supports you.  * *
>http://evolt.org/help_support_evolt/
>
>For unsubscribe and other options, including the Tip Harvester and 
>archives of thelist go to: http://lists.evolt.org Workers of the 
>Web, evolt !


-- 

/
\ kris krois
/ gestaltung
\
/ kris at phlux.org
\ phon +49 - (0)89 - 90 93 63-55
/ cell +49 - (0)174 - 746 37 39
\


More information about the thelist mailing list