S
shankwheat
I'm creating a dynamic table with asp and I would like to add a "Show
All" and "Collapse All" feature to show/hide certain rows within the
table. This code works well for showing/hiding one row at a time but
I'm not sure how to all the "Show All/Hide All" feature. Thanks.
function sh_RowShowHide(sh_RowID) {
var currRow = document.getElementById(sh_RowID);
if (currRow.style.display=="none") {
currRow.style.display="";
document.getElementById(sh_RowID+"img").src = sh_HideImg;
} else {
currRow.style.display="none";
document.getElementById(sh_RowID+"img").src = sh_ShowImg;
}
}
<table>
<tbody id="EventsBody">
<tr>
<td></td>
<td>Event Date</td>
<td>Event</td>
</tr>
<% Do While Not rs_Events.EOF %>
<tr>
<td><img border="0" id="<%=rs_Events("EventID")%>img"
style="clear:both;"
onclick="sh_RowShowHide('<%=rs_Events("EventID")%>',0); return false;"
src="directory_minus.gif" /></td>
<td><%=rs_Events("EventDate")%></td>
<td><%=rs_Events("UpdateDescription")%></td>
</tr>
<tr id="<%=rs_Events("EventID")%>" style="display:inline;">
<td colspan="3"><%=rs_Events("EventDescription")%></td>
</tr>
<%
rs_Events.MoveNext
Loop
%>
</tbody>
</table>
All" and "Collapse All" feature to show/hide certain rows within the
table. This code works well for showing/hiding one row at a time but
I'm not sure how to all the "Show All/Hide All" feature. Thanks.
function sh_RowShowHide(sh_RowID) {
var currRow = document.getElementById(sh_RowID);
if (currRow.style.display=="none") {
currRow.style.display="";
document.getElementById(sh_RowID+"img").src = sh_HideImg;
} else {
currRow.style.display="none";
document.getElementById(sh_RowID+"img").src = sh_ShowImg;
}
}
<table>
<tbody id="EventsBody">
<tr>
<td></td>
<td>Event Date</td>
<td>Event</td>
</tr>
<% Do While Not rs_Events.EOF %>
<tr>
<td><img border="0" id="<%=rs_Events("EventID")%>img"
style="clear:both;"
onclick="sh_RowShowHide('<%=rs_Events("EventID")%>',0); return false;"
src="directory_minus.gif" /></td>
<td><%=rs_Events("EventDate")%></td>
<td><%=rs_Events("UpdateDescription")%></td>
</tr>
<tr id="<%=rs_Events("EventID")%>" style="display:inline;">
<td colspan="3"><%=rs_Events("EventDescription")%></td>
</tr>
<%
rs_Events.MoveNext
Loop
%>
</tbody>
</table>