Maybe this is a very simple problem, but I ignored the single-choice button when learning the program. This leads to a gap in his data transfer method. The following table describes how to obtain the data of the age selection form. The test is successful only in IE. First test the effect of this program.
Copy codeThe Code is as follows:
<Form method = "post" name = "form1">
<Label> <input type = "radio" name = "radio" value = "1-10"> 1-10 </label>
<Label> <input type = "radio" name = "radio" value = "11"> 11 </label>
<Label> <input type = "radio" name = "radio" value = "12-120"> 12-120 </label>
<Input type = "button" onclick = "OK ()" value = "test select value">
</Form>
The following is how js obtains data:
Copy codeThe Code is 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 );
// Obtain the Radio Value
Document. form2.textfield. value = "you have selected" + temp [I]. value;
// Pass it to another form
}
}
}
-->
</Script>
You also want to pass data to another form.
Copy codeThe Code is as follows: <form method = "post" name = "form2">
<Input type = "text" name = "textfield">
</Form>
References
Js: http://www.blueidea.com/tech/web/2006/3567_8.asp
Form: http://www.netvtm.com/w3s/html/html-forms.html