View Full Version : childObjects of a table/tbody

12-17-2004, 01:09 AM
Ok. I have to learn this sometime I guess, lol.

I want to cycle through each row of a table and perform a function on it. In the past, I've simply given each row an ID number, like (id="row1", id="row2") etc. I now have a huge table, and that would be tiresome.

I need to find a way to use some method of cycling through each table's rows and performing a function on it. I thought something like "theTable.childObjects" would do the trick, but I'm not sure what I'm doing. If at all possible, can all of the child objects of a <TBODY> tag be cycled through instead of an entire table? If not, that's ok. I just need *some* method of doing this other than the row numeration.


Thanks in advance.

12-17-2004, 02:14 AM
<tbody id="blah">
var rows = document.getElementById('blah').getElementsByTagName("TR");
for (var i=0; i<rows.length; i++)

12-17-2004, 02:53 AM
ok.... hmm... that worked great except...

how do i get the CSS class name of an object? i.e.:

<TR class=scheduleES>...

in the above script, i tried rows[i].class but it didnt work. any help?

12-17-2004, 03:00 AM

12-17-2004, 03:08 AM
very sorry. i didn't search the MSDN 'object' database before posting :(

thanks for all your help!