View Full Version : getting true <tr> height
Ultragames
08-27-2005, 12:00 AM
Is there way to get the true height of a <tr> Not what the <tr height=''> is set to, but what its actual on screen height is?
If there is, a quick reply is appriciated.
Thanks.
Is there way to get the true height of a <tr> Not what the <tr height=''> is set to, but what its actual on screen height is?
If there is, a quick reply is appriciated.
Thanks.
Try offsetheight (this doesn't work in safari, not sure why. You may need to check a cell rather than the tr):
<html>
<head>
<script type="text/javascript">
function init() {
var tr1 = document.getElementById("tr1");
var tr2 = document.getElementById("tr2");
alert("rt1: " + tr1.offsetHeight + ", tr2: " + tr2.offsetHeight);
}
</script>
</head>
<body onload="init()">
<table width="200" border="1">
<tr id="tr1">
<td> asdf<br /><br /><br /></td>
<td> </td>
<td> </td>
</tr>
<tr id="tr2">
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
for gecko-based, I believe getComputedStyle will do what you want:
http://www.mozilla.org/docs/dom/domref/examples.html#998756
you can "manually" see what it produces if you have the DOM Inspector (go to a node then on the lefthand side click 'Computed Style' from the menu)
Ultragames
08-27-2005, 10:34 AM
Thanks guys.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.