I am new to prototype and need to learn how to traverse an html table
and hide some columns. The only id I have is table id or the class it
is associated with. Can anyone give me an example?
Here is what I am trying to accomplish.
var tbl =
document.getElementById('ctl00_m_g_0ab7c148_0e6c_49e4_bc03_fd1064ca4b41_ctl00_Grid');
if (tbl != null){
var rows = tbl.getElementsByTagName('tr');
var cols = rows[0].getElementsByTagName('th');
cols[0].style.width = '300px';
cols[1].style.display = 'none';
cols[2].style.display = 'none';
//Now loop through the data rows and hide specific cells
for (var row = 1; row < rows.length; row++) {
var cels = rows[row].getElementsByTagName('td');
//alert(cels[1].valueOf);
cels[0].style.width = '300px';
cels[1].style.display = 'none';
cels[2].style.display = 'none';
}
}
Thanks!
Ken
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.