Click to See Complete Forum and Search --> : [DOM]Getting Table Width that is not specified


jamestmfbong
04-29-2006, 09:44 AM
<html>
<body>

<table width=100%><tr><td id="mainTable">
asdf
</td>
<td width="200" id="mainTable2">asd</td>
</tr></table>

<script>
alert( document.getElementById("mainTable").width );
alert( document.getElementById("mainTable2").width );
</script>

</body>
</html>

The first alert is blank, the second is 200. Obviously the first is blank b/c I didn't specify the attribute. Is there a way to get a returned value though?

vwphillips
04-29-2006, 10:22 AM
.offsetWidth