I am using code as below to expand & collapse table rows...
I wish to:
1) default to a collapsed view instead of expanded
2) exchange the plus.gif image for minus.gif as appropriate
TIA,
-Allen M.
I wish to:
1) default to a collapsed view instead of expanded
2) exchange the plus.gif image for minus.gif as appropriate
TIA,
-Allen M.
Code:
<html>
<head>
<script type="text/javascript">
var rowVisible = true;
function toggleDisplay(tbl) {
var tblRows = tbl.rows;
for (i = 0; i < tblRows.length; i++) {
if (tblRows[i].className != "headerRow") {
tblRows[i].style.display = (rowVisible) ? "none" : "";
}
}
rowVisible = !rowVisible;
}
</script>
</head>
<body>
<table id="thread_1" border="1" width="200">
<tr class="headerRow">
<th><a href="#" onclick="toggleDisplay(document.getElementById('thread_1'))" ><IMG SRC="./images/plus.gif"></a>< click</th>
<th colspan = "2">thread 1</th>
</tr>
<tr>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td>test2</td>
<td>test2</td>
<td>test2</td>
</tr>
<tr>
<td>test3</td>
<td>test3</td>
<td>test3</td>
</tr>
<tr>
<td>test4</td>
<td>test4</td>
<td>test4</td>
</tr>
</table>
<table id="thread_2" border="1" width="200">
<tr class="headerRow">
<th><a href="#" onclick="toggleDisplay(document.getElementById('thread_2'))" ><IMG SRC="./images/plus.gif"></a>< click</th>
<th colspan = "2">thread 2</th>
</tr>
<tr>
<td>test</td>
<td>test</td>
<td>test</td>
</tr>
<tr>
<td>test2</td>
<td>test2</td>
<td>test2</td>
</tr>
<tr>
<td>test3</td>
<td>test3</td>
<td>test3</td>
</tr>
</table>
</body></html>