goobydooby
Technical User
I am a novice javascript programmer.
I am trying to use radio buttons to make a choice between yes and no on a form. I then want to display the value of the checked button.
I have looked in the archives and come up with the following but in IE5 it will not display the value. Any tips or have I missed something obvious.
Many thanks in advance.
<P>
<B> Are there sensitive neighbours nearby? </B>
<!-- sets constraints for noise and odour with radio buttons to choose yes or no-->
Yes: <INPUT TYPE = "RADIO" NAME = "Neighbours" VALUE="true" checked>
No: <INPUT TYPE = "RADIO" NAME = "Neighbours" VALUE="false">
</FORM>
<P>
<SCRIPT>
//script to use value from radio buttons to determine
//the value of the variable neighbours
//as there is only a choice between two buttons a
//simple if else statement is used
var neighbours="";
IF(document.Decision.Neighbours[1].checked)
{neighbours="false";}
ELSE{neighbours="true"};
document.write(neighbours)
</SCRIPT>
I am trying to use radio buttons to make a choice between yes and no on a form. I then want to display the value of the checked button.
I have looked in the archives and come up with the following but in IE5 it will not display the value. Any tips or have I missed something obvious.
Many thanks in advance.
<P>
<B> Are there sensitive neighbours nearby? </B>
<!-- sets constraints for noise and odour with radio buttons to choose yes or no-->
Yes: <INPUT TYPE = "RADIO" NAME = "Neighbours" VALUE="true" checked>
No: <INPUT TYPE = "RADIO" NAME = "Neighbours" VALUE="false">
</FORM>
<P>
<SCRIPT>
//script to use value from radio buttons to determine
//the value of the variable neighbours
//as there is only a choice between two buttons a
//simple if else statement is used
var neighbours="";
IF(document.Decision.Neighbours[1].checked)
{neighbours="false";}
ELSE{neighbours="true"};
document.write(neighbours)
</SCRIPT>