Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Size of a table cell?

Status
Not open for further replies.

zapster

Programmer
Jun 8, 2001
36
GB
Hi all


I Need to refer to a table cell in javascript can this be done?


The problem is i need to obtain the size of a table cell which is populated dynamicly with text and image data so that I can scale an image in another table.

IE i want to find the height and width of the cell

please let me know how i can do this

Thanks


Zapster
 
I found a way to do it if you tell what height you want the cell to be in the <td> tag... here is my code...

<html>
<head>
<title>Test</title>
<script language=&quot;JavaScript&quot;>
function fnctable()
{
alert(document.getElementById('cell1').height);
}
</script>
<body onLoad=&quot;fnctable();&quot;>
<table name=&quot;table1&quot; border=1><tr><td id=&quot;cell1&quot; height=50>
HELLLO!!!</td></tr></table>
</body>
</html>

Later,
Greelmo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top