I am trying to expand and collapse rows of information and stuff by clicking a button. Well, I am able to expand and collapse one column with getElementById, but no more. I think I need an array or soemthing to do it... take a look at the code quick:
JS
else if(ie5 || ns6){
var x=document.getElementsByName(id);
for (i=1; i<x; i++){
if (document.getElementById(id).style.display == "none"){
document.getElementById(id).style.display = "block";
}else{
document.getElementById(id).style.display = "none";
}
}
}
HTML
<style>
.branch{
display: none;
border-bottom: '1px solid black'
}
</style>
<table>
<tr>
<td>
<input type="button" value="Show" class="niceButton" onclick="show('Branch0')" />
</td>
<td>
<input type="button" value="Hide" class="niceButton" onclick="hide('Branch0')" />
</td>
<td>
test
</td>
</tr>
<tr>
<td id="branch0" class="branch">
Column1.1
</td>
<td id="branch0" class="branch">
Column1.2
</td>
<td id="branch0" class="branch">
Column1.3
</td>
</tr>
<tr>
<td id="branch0" class="branch">
Column2.1
</td>
<td id="branch0" class="branch">
Column2.2
</td>
<td id="branch0" class="branch">
Column2.3
</td>
</tr>
</table>
So you see I am wanting to loop through getElementById, but I have no method of progressing through, it just stays on the first record. So I am wondering if there is a way to loop through every ID set at "branch0" or whatever other name it is set at. Or maybe there is just a better way of doing this. It needs to expand multiple columns too. So that is why I don't jsut hide the <tr> tag. Thanks!
EDIT: BTW, this is going to be used for drilling down on details in a table deal...
This post has been edited by Fygar: 07 April 2003 - 08:51 AM

New Topic/Question
Reply


MultiQuote



|