Click to See Complete Forum and Search --> : Access to table cell width?


karayan
09-04-2003, 12:35 PM
I do not see tables a property of the document object, so I am wondering... Is there a way to access the width of a td element?

Khalid Ali
09-04-2003, 12:41 PM
<td width="100">

can be accessed as follows

assuming there is only one td element in whole document

var tds = document.getElementsByTagName("TD")[0];
alert(tds.getAttribute("width"));

karayan
09-04-2003, 12:54 PM
In case of more TDs in the doc, would subsequent TDs be accesed as further elements of that array ([1],[2],...)? And can the properties of that TD be set or just read?

karayan
09-04-2003, 12:57 PM
I find it amazing that there is no TABLE property for the document object. Is that because they were planning to phase TABLEs out in favor of CSS? [I don't want to start another tables-vs-CSS war. Just wondering...:D ]

Khalid Ali
09-04-2003, 12:57 PM
yes exactly..:D

Khalid Ali
09-04-2003, 12:59 PM
Originally posted by karayan
Is that because they were planning to phase TABLEs out in favor of CSS? ]

I am firm believer of that notion,however, there are plenty of people around here who would dis agree..:D

Charles
09-04-2003, 01:07 PM
Originally posted by karayan
Is that because they were planning to phase TABLEs out in favor of CSS?There's no planning about it, we were offically instructed to not use TABLEs for layout back in 1997.

Khalid Ali
09-04-2003, 01:28 PM
Originally posted by Charles
There's no planning about it,.

Here is one of them..:D