Reputation: 6945
I have a table in HTML code.
I need to get height of that table using JavaScript, so
alert(document.getElementById('myTable').clientHeight);
returns a correct value in IE, but always returns 0 in FF.
How can I get the height of the table in Firefox?
Thanks!
Upvotes: 1
Views: 5426
Reputation: 13485
Maybe comeone can correct me here, but if you want to get the height of a specific element then why not just use
EDIT: this only works if the element has inline styles and a defined height
document.getElementById('myReputation').style.height;
Upvotes: 0
Reputation: 21763
clientHeight
is a non-standard, HTML-specific property introduced in the Internet Explorer object model.
In Firefox, the offsetHeight
property contains the current pixel height of an element, so you can use something like:
var theHeight = element.clientHeight || element.offsetHeight;
Upvotes: 5
Reputation: 1101
Did you tried offsetHeight? See http://www.quirksmode.org/dom/w3c_cssom.html
Upvotes: 1