as far as keeping state upon refresh you would need a cookie
take a look at the answer in this question
http://experts-exchange.co
every time hte user clicked you would need to store the state the user was in, whenever the page loads, just check for hte existance of that cookie, whatever value is in it would tell you how to default your display
something like
<body onload="GetDisplayFromCook
then in get DisplayFromCookie( )
document.getElementById( "idTableBody" ).style.display = whatevervalueisincookie;
Main Topics
Browse All Topics





by: justinbilligPosted on 2005-01-07 at 10:20:28ID: 12986200
<script language="javascript">
= strDisplay;
this )" value="+" name="btnToggle" style="width:20;">
function ToggleRowDisplay( objTargetButton )
{
try
{
// Variables
var strDisplay = "block";
var objTableBody = document.getElementById( "idTableBody" );
var strButtonValue = "-";
// Toggle Display
if( objTargetButton.value == "-" )
{
// Hide
strDisplay = "none";
strButtonValue = "+";
}
// Toggle the table
objTableBody.style.display
// Set button Value
objTargetButton.value = strButtonValue;
}
catch( expError )
{
alert( expError.number + " " + expError.description );
}
}
</script>
<html>
<body>
<table border="0">
<thead>
<tr>
<th>Can Always See Me
</tr>
<tr>
<th>Can Always See Me
</tr>
<tr>
<th>Can Always See Me
</tr>
<tr>
<th>Can Always See Me
</tr>
<tr>
<th>Can Always See Me
</tr>
</thead>
<tbody id="idTableBody" style="display:none;">
<tr>
<td>Can Sometimes See Me</td>
</tr>
<tr>
<td>Can Sometimes See Me</td>
</tr>
<tr>
<td>Can Sometimes See Me</td>
</tr>
<tr>
<td>Can Sometimes See Me</td>
</tr>
<tr>
<td>Can Sometimes See Me</td>
</tr>
</tbody>
</table>
<input type="button" onclick="ToggleRowDisplay(
</body>
</html>