Script doesn't see form control
One problem I'm having is that The script in this HTML doesn't see the control called "gender" and always read's its value as "undefined". A previous posting which is gone now had some good advice.
The other problem is that I had a thread started here and I'm not sure if I put it in the wrong forum or what but it's gone. So PLEASE, if this posting violates a rule let me know, I'm new at this!
<INPUT TYPE="TEXT" NAME="actualValue" SIZE=40> should be "M" or "F" </INPUT><BR><P>
<INPUT TYPE="radio" NAME="gender" value="M" checked>Male<BR>
<INPUT TYPE="radio" NAME="gender" value="W">Female<BR><BR>
<INPUT TYPE="button" NAME="myButt" value = "Click to see radio button value" onClick=myFunction()></INPUT>
document.forms.actualValue.value = document.forms.gender.value;
// should be "M" or "F" but it's "undefined"
Well the reason it's undefined is because you've got TWO elements named 'gender'. So how does JS know which one you're talking about?
Because you've got two elements name gender, you've now got a gender array. Try this function instead of what you're using and see how it works out for you:
|All times are GMT +1. The time now is 09:46 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.