<table width="225" border="0">
<tr>
<td width="10" id="MyCell1"
onclick="ShowHide('MyRow1','MyCell1')"><img
src="images/plus3.gif"></td>
<td width="205">blahasdfadfadfasd</strong></a></div></td>
</tr>
<tr id="MyRow1">
<td> </td>
<td>
<table width="100%" border="0">
<tr>
<td>teadasdgadsf</a></td>
</tr>
</table>
</td></tr>
<tr>
<td width="10" id="MyCell2"
onclick="ShowHide('MyRow2','MyCell2')"><img
src="images/plus3.gif"></td>
<td width="205">blahasdfadfadfasd</strong></a></div></td>
</tr>
<tr id="MyRow2">
<td> </td>
<td>
<table width="100%" border="0">
<tr>
<td>teadasdgadsf</a></td>
</tr>
</table>
</td></tr>
<tr>
<td width="10" id="MyCell3"
onclick="ShowHide('MyRow3','MyCell3')"><img
src="images/plus3.gif"></td>
<td width="205">blahasdfadfadfasd</strong></a></div></td>
</tr>
<tr id="MyRow3">
<td> </td>
<td>
<table width="100%" border="0">
<tr>
<td>teadasdgadsf</a></td>
</tr>
</table>
</td></tr>
</table>
<script type="text/javascript">
var m_intShow = 0;
function ShowHide(strRowID,strCellID)
{
var objRow = document.getElementById(strRowID);
if (m_intShow == 0)
{
objRow.style.display = "block";
var objCell = document.getElementById(strCellID);
objCell.innerHTML = "<img src=images/minus2.gif>";
m_intShow = 1;
}
else
{
objRow.style.display = "none";
var objCell = document.getElementById(strCellID);
objCell.innerHTML = "<img src=images/plus3.gif>";
m_intShow = 0;
};
}
function runhide(){
var objs = new Array();
rowCount = this.asdfform.txtAID.value;
for(var i=1;i<=rowCount;i++){
(objs[i] = document.getElementById("MyRow"+i)).style.display =
"none";
}
}
runhide()
</script>
So everything works really good on load up, it loads the rows in the
tables. When the table is done, the javascript loads runhide() which
collapses all of the rows.
The javascript works fine when they click on the plus and it shows the
row, and when I click on the same plus it collapses. The problem
is...when I click the first cell, it shows the row, then If I want to
expand cell 2, I have to click it twice to get it to expand. Then when
I go to cell 1, I have to click twice to collapse it.
If anyone can correct my coding it would be appreciated, thanks.