Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

for.. Loop New Javascripter needs help!!

Status
Not open for further replies.

sdh

Programmer
Joined
Apr 30, 2001
Messages
121
Location
GB
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=&quot;text/javascript&quot; language=&quot;JavaScript&quot;>

<!------
function CheckRadio(y){
var x=document.frmregister

for (var i=0;i<4;i++)
if (x.radiobutton.checked)
{
user_input = y.value;
document.forms[&quot;frmregister&quot;].firstname.value= user_input }
}

//-->
</script>

<input type=&quot;radio&quot; name=&quot;radiobutton&quot; value=&quot;Mr&quot; onclick=&quot;return CheckRadio(this);&quot;>
Mr
<input type=&quot;radio&quot; name=&quot;radiobutton&quot; value=&quot;Mrs&quot; onclick=&quot;return Checkradio(this);&quot;>
Mrs
<input type=&quot;radio&quot; name=&quot;radiobutton&quot; value=&quot;Dr&quot; onclick=&quot;return Checkradio(this);&quot;>
Dr
<input type=&quot;radio&quot; name=&quot;radiobutton&quot; value=&quot;Other&quot; onclick=&quot;return Checkradio(this);&quot;>
Other </TD>

thanks
sdh ::)
 
doh !!!
As a vb programmer don't usually come up against this issue.
Thanks anyone who has looked at it but I now realise about Case-sensitivity in Java.

SDh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top