Having a script inside a table where an id is declared returns "0" for the id's offsetWidth and clientWidth despite any content the object may have.
This example will work:
<table><tr><td id="tablecell1">Some content to give it a width</td></tr></table>
<script>alert(document.all.tablecell1.offsetWidth);</script>
This one will not:
<table><tr><td id="tablecell1">
Some content to give it a width
<script>alert(document.all.tablecell1.offsetWidth);</script>
</td></tr></table>
Nor will this nested example in which the inner table is closed:
<table><tr><td>
<table><tr><td id="nested1">Some content to give it a width</td></tr></table>
<script>alert(document.all.nested1.offsetWidth);</script>
</td></tr></table>
This is the above corrected:
<table><tr><td>
<table><tr><td id="nested1">Some content to give a width</td></tr></table>
</td></tr></table>
<script>alert(document.all.nested1.offsetWidth);</script>