Dear JS-ers!
On my page the row "row" repeats itself many times, and I want to refer to something on a certain row, and I want to make this stg. visible / invisible. I can not use the document.getElementById(), because then JS does not know, which row I am speaking about.. But in this way it is therribly ugly, and if something else changes on my page, then this hard coded 14 is not 14 any more (but maybe 15 or 13 or whatever...)
Could anybody show me an other way to do this (not using hard coded values)?
from my jsp:
Any help would be appreciated, including references to other posts with the same topic...
heeeep
On my page the row "row" repeats itself many times, and I want to refer to something on a certain row, and I want to make this stg. visible / invisible. I can not use the document.getElementById(), because then JS does not know, which row I am speaking about.. But in this way it is therribly ugly, and if something else changes on my page, then this hard coded 14 is not 14 any more (but maybe 15 or 13 or whatever...)
Could anybody show me an other way to do this (not using hard coded values)?
Code:
function toggleSomething(row)
{
if( row.getElementsByTagName('div')[14].style.display == '')
{
row.getElementsByTagName('div')[14].style.display = "none";
row.getElementsByTagName('div')[14].style.visibility = "hidden";
}
else
{
row.getElementsByTagName('div')[14].style.display = '';
row.getElementsByTagName('div')[14].style.visibility = "visible";
}
}
from my jsp:
Code:
...
<table id="thetable" style="visibility:hidden;" >
<tr id="therow">
...
...here is something I want to toggle with the JS...
...
</tr>
</table>
...
Any help would be appreciated, including references to other posts with the same topic...
heeeep