M
MOHSEN KASHANI
Hi,
I am trying to hide some form elements in a form by default and show/hide
depending on which radio button is clicked. This is what I have but it is
not working:
<head>
<style>
..noshow {
display: none;
}
..menu {
display: block;
}
</style>
<script language="JavaScript" type="text/javascript">
if( document.getElementById )
getElemById = function( id ) {
return document.getElementById( id );
}
else if( document.all )
getElemById = function( id ) {
return document.all[ id ];
}
else if( document.layers )
getElemById = function( id ) {
return document.layers[ id ];
}
function hide(ele)
{
getElemById(ele).className = "noshow";
}
function show(ele)
{
getElemById(ele).className = "menu";
}
</script>
</head>
<body>
<form>
<div align="center">
<table>
<tr>
<td>Yes or No</td>
<td>
Yes <input type="radio" name="yes" value="1"
onClick="javascript:show('dn');" />
No <input type="radio" name="no" value="0" checked
onClick="javascript:hide('dn');" />
</td>
<div id="dn" class="noshow">
<tr>
<td>
<some elements to be hidden or shown dending onwhat button is clicked>
</td>
</tr>
</table>
</form>
</body>
TIA.
I am trying to hide some form elements in a form by default and show/hide
depending on which radio button is clicked. This is what I have but it is
not working:
<head>
<style>
..noshow {
display: none;
}
..menu {
display: block;
}
</style>
<script language="JavaScript" type="text/javascript">
if( document.getElementById )
getElemById = function( id ) {
return document.getElementById( id );
}
else if( document.all )
getElemById = function( id ) {
return document.all[ id ];
}
else if( document.layers )
getElemById = function( id ) {
return document.layers[ id ];
}
function hide(ele)
{
getElemById(ele).className = "noshow";
}
function show(ele)
{
getElemById(ele).className = "menu";
}
</script>
</head>
<body>
<form>
<div align="center">
<table>
<tr>
<td>Yes or No</td>
<td>
Yes <input type="radio" name="yes" value="1"
onClick="javascript:show('dn');" />
No <input type="radio" name="no" value="0" checked
onClick="javascript:hide('dn');" />
</td>
<div id="dn" class="noshow">
<tr>
<td>
<some elements to be hidden or shown dending onwhat button is clicked>
</td>
</tr>
</table>
</form>
</body>
TIA.