Hey guys. I'm in need of some help here. I am building a table that initially has a few hidded rows. I have menu links to click on that will make these rows visible to display a menu. So every hidded row has a link that will show it. I have this part working so far, but what I can't figure out is how to only show one row from the table at a time. As of right now, I can unhide many rows and they will all show simultaneously. I want to set it so that if a row is already visible when another link is clicked, it will first hide the visible row, then open the hidden one. Here is the code I am using to display and hide row:
<script type=\"text/javascript\">
function showhide(row)
{
if(document.all[row].style.display == 'none')
{
document.all[row].style.display ='';
}
else{ document.all[row].style.display ='none'; }
return false;
}
</script>
-------------------------------------------------------
Here is the code for the table elements:
-------------------------------------------------------
<table class=\"tbl01\">
<tr id=\"approve\" style=\"display:none\">
<td class=\"td12\" align=\"center\">SOME STUFF HERE...</td>
</tr>
<tr id=\"add\" style=\"display:none\">
<td class=\"td12\" align=\"center\">OTHER STUFF HERE...</td>
</tr>
<tr id=\"edit\" style=\"display:none\">
<td class=\"td12\" align=\"center\">EVEN MORE STUFF...</td>
</tr>
</tabl>
-------------------------------------------------------
Then I use these links to show/hide rows:
-------------------------------------------------------
<a class=\"link08\" onClick=\"showhide('approve'); return false;\" href=\"\">Link1</a>
<a class=\"link08\" onClick=\"showhide('add'); return false;\" href=\"\">Link2</a>
<a class=\"link08\" onClick=\"showhide('edit'); return false;\" href=\"\">Link3</a>
The above code allows me to make all three hidden rows visible at the same time. How can I get it to only show one row at a time? Please let me know if you have any advice. Thanks!
<script type=\"text/javascript\">
function showhide(row)
{
if(document.all[row].style.display == 'none')
{
document.all[row].style.display ='';
}
else{ document.all[row].style.display ='none'; }
return false;
}
</script>
-------------------------------------------------------
Here is the code for the table elements:
-------------------------------------------------------
<table class=\"tbl01\">
<tr id=\"approve\" style=\"display:none\">
<td class=\"td12\" align=\"center\">SOME STUFF HERE...</td>
</tr>
<tr id=\"add\" style=\"display:none\">
<td class=\"td12\" align=\"center\">OTHER STUFF HERE...</td>
</tr>
<tr id=\"edit\" style=\"display:none\">
<td class=\"td12\" align=\"center\">EVEN MORE STUFF...</td>
</tr>
</tabl>
-------------------------------------------------------
Then I use these links to show/hide rows:
-------------------------------------------------------
<a class=\"link08\" onClick=\"showhide('approve'); return false;\" href=\"\">Link1</a>
<a class=\"link08\" onClick=\"showhide('add'); return false;\" href=\"\">Link2</a>
<a class=\"link08\" onClick=\"showhide('edit'); return false;\" href=\"\">Link3</a>
The above code allows me to make all three hidden rows visible at the same time. How can I get it to only show one row at a time? Please let me know if you have any advice. Thanks!
Comment