I have to hide certain rows in a table under certain conditions. What I'm doing is something like this:
The button is just to play with. Eventually there will be a function that toggles between hiding and showing the rows.
Now this works, but according to my reference books, the ID attribute must be unique for each element. So, am I setting myself up for a fall here, or is this OK? I don't want to get it working and then lose the functionality in the next browser upgrade.
Anyone have any ideas? And if this isn't kosher, can anyone suggest an alternative?
I would be greatly appreciative of any help.
Code:
<TABLE>
<TR>
<TD CLASS="mainlabel">
Stuff to show
</TD>
</TR>
<TR ID="hide">
<TD CLASS="mainlabel">
Stuff to be hidden
</TD>
</TR>
<TR ID="hide">
<TD CLASS="mainlabel">
more stuff to be hidden
</TD>
</TR>
<TR>
<TD CLASS="mainlabel">
More stuff to show
</TD>
</TR>
</TABLE>
<input type=button value="Hide" onClick="
for(x=0 ; x < hide.length ; x++){
hide[x].style.visibility = 'hidden';
hide[x].style.display = 'none';
}
">
The button is just to play with. Eventually there will be a function that toggles between hiding and showing the rows.
Now this works, but according to my reference books, the ID attribute must be unique for each element. So, am I setting myself up for a fall here, or is this OK? I don't want to get it working and then lose the functionality in the next browser upgrade.
Anyone have any ideas? And if this isn't kosher, can anyone suggest an alternative?
I would be greatly appreciative of any help.