Maybe this is a very simple question, but I ignored the radio button while I was learning the program. Lead to a vacancy for his method of data delivery. After whining help to achieve the following about age-selected forms of data acquisition, only in IE test successfully. Test the effect of the program first.
Copy Code code as follows:
<form method= "Post" Name= "Form1" >
<label><input type= "Radio" name= "Radio" value= "1-10 years old" >1-10 years old </label>
<label><input type= "Radio" name= "Radio" value= "11 years old" >11 years old </label>
<label><input type= "Radio" name= "Radio" value= "12-120 years old" >12-120 years old </label>
<input type= "button" onclick= "OK ()" value= "Test selection value" >
</form>
Here is JS fetch data
Copy Code code as follows:
<script language= "javascript" type= "Text/javascript" >
<!--
function ok ()
{
var temp=document.getelementsbyname ("Radio");
for (i=0;i<temp.length;i++) {
Traverse Radio
if (temp[i].checked)
{Alert ("you selected" +temp[i].value);
Gets the value of the radio
Document.form2.textfield.value= "You have chosen" +temp[i].value;
Pass to another form
}
}
}
-->
</script>
Also want data to be passed to another form
Copy Code code as follows:
<form method= "POST" name= "Form2" >
<input type= "text" name= "TextField" >
</form>
Resources
Js:http://www.blueidea.com/tech/web/2006/3567_8.asp
Form:http://www.netvtm.com/w3s/html/html-forms.html