Below is my script.
It is supposed to check the radio buttons and return there value to the text box but it only works for the first radio button. Form is called frmregister and the input code is as below. Please please help
<script type="text/javascript" language="JavaScript">
<!------
function CheckRadio
{
var x=document.frmregister
for (var i=0;i<4;i++)
if (x.radiobutton.checked)
{
user_input = y.value;
document.forms["frmregister"].firstname.value= user_input }
}
//-->
</script>
<input type="radio" name="radiobutton" value="Mr" onclick="return CheckRadio(this);">
Mr
<input type="radio" name="radiobutton" value="Mrs" onclick="return Checkradio(this);">
Mrs
<input type="radio" name="radiobutton" value="Dr" onclick="return Checkradio(this);">
Dr
<input type="radio" name="radiobutton" value="Other" onclick="return Checkradio(this);">
Other </TD>
thanks
sdh :
It is supposed to check the radio buttons and return there value to the text box but it only works for the first radio button. Form is called frmregister and the input code is as below. Please please help
<script type="text/javascript" language="JavaScript">
<!------
function CheckRadio

var x=document.frmregister
for (var i=0;i<4;i++)
if (x.radiobutton.checked)
{
user_input = y.value;
document.forms["frmregister"].firstname.value= user_input }
}
//-->
</script>
<input type="radio" name="radiobutton" value="Mr" onclick="return CheckRadio(this);">
Mr
<input type="radio" name="radiobutton" value="Mrs" onclick="return Checkradio(this);">
Mrs
<input type="radio" name="radiobutton" value="Dr" onclick="return Checkradio(this);">
Dr
<input type="radio" name="radiobutton" value="Other" onclick="return Checkradio(this);">
Other </TD>
thanks
sdh :
