469,568 Members | 1,395 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,568 developers. It's quick & easy.

document.body.clientHeight returns 0 in Firefox

Does anyone know why this returns 0 in Firefox (2) and correct value
in IE (7)?

alert(document.body.clientHeight);

Thank you.

Feb 8 '07 #1
2 10334
On Feb 8, 10:14 am, arman_leg...@hotmail.com wrote:
Does anyone know why this returns 0 in Firefox (2) and correct value
in IE (7)?

alert(document.body.clientHeight);
What makes you think IE is correct? Try the following with and
without a doctype. You may wish to discuss the results on
comp.infosystems.www.authoring.stylesheets:

<URL: http://groups.google.com/group/
comp.infosystems.www.authoring.stylesheets/ >

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>clientHeight</title>
<style type="text/css">
body {margin: 0; padding: 0;}
</style>
<body onload="alert(document.body.clientHeight);"></body>
--
Rob

Feb 8 '07 #2
It differs on different browsers, which I think is bad.

Please take a look here: http://www.quirksmode.org/js/doctypes.html

Feb 8 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Kepler | last post: by
6 posts views Thread by maya | last post: by
3 posts views Thread by Cylix | last post: by
reply views Thread by trullock | last post: by
8 posts views Thread by dhtml | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.