The code below supposed to display/hide a <TR> when a radio button is selected. However I have a problem: when I click on the second one (no), it works as designed and hides. However, when you click back on the first one (yes), it displays as designed BUT the 'no' radio button is still checked and you have to click on 'yes' again.
In other words you have to click on 'yes' twice. While it gained focus, that does not reflect in the radio state.
<script type="text/JavaScript">
function shownav(theTable)
{
obj = document.getElementsByTagName('TR');
for (i=0; i<obj.length; i++)
{
if (obj[i].id == theTable)
obj[i].style.display = '';
}
}
function hidenav(theTable)
{
obj = document.getElementsByTagName('TR');
for (i=0; i<obj.length; i++)
{
if (obj[i].id == theTable)
obj[i].style.display = 'none';
}
}
</script>
html
<tr>
<td>Display Navigation?</td>
<td align="center"><input checked type="radio" name="navigation" value="1" onfocus="shownav('magnav');return true;" />
Yes</td>
<td align="center" class="mag_alt2">No
<input class="bginput" type="radio" name="navigation" value="0" onfocus="hidenav('magnav');return false;" />
</td>
</tr>
<TR width="100%" id="magnav" style="display: visible;">
<td width="100%" colspan="3><strong>Navigation</strong></td>
</td>
</tr>