Entry
How do I find the (computed) width/height of a TABLE cell?
Apr 14th, 2000 16:14
Martin Honnen,
With IE4+ and NN6 you can read
tableElement.offsetWidth
tableElement.offsetHeight
Example:
<HTML>
<HEAD>
<STYLE>
.js {
color: white;
background-color: orange;
}
</STYLE>
<SCRIPT>
</SCRIPT>
</HEAD>
<BODY>
<TABLE BORDER="1">
<TR>
<TD ONCLICK="alert(this.offsetWidth + 'X' + this.offsetHeight)">
Kibo
</TD>
<TD CLASS="js" ONCLICK="alert(this.offsetWidth + 'X' +
this.offsetHeight)">
JavaScript.FAQTs.com
</TD>
</TR>
</TABLE>
</DIV>
</BODY>
</HTML>