The example in this article describes the method of JS simple to get the radio button value in the form. Share to everyone for your reference, specific as follows:
The HTML section is as follows:
<form>
<tr bgcolor= "#FFFFFF" > <td width= "height=" "rowspan="
3 "align=" Center "valign=" Middle "
bordercolor=" #999999 "><span class=" STYLE1 "> Fallback type:</span></td> <td
" 360 "align=" center "valign=" Middle "bordercolor=" #999999 "><input type=" Radio "name=" Returntag "
value="-1 " checked= "Checked" >
Reporting Department </td>
</tr>
<tr bgcolor= "#FFFFFF" >
<td align= " Center "valign=" middle "bordercolor=" "#999999" ><input type= "Radio" name= "Returntag" value= "
1" > Provincial Network Bidding Center </td>
</tr>
<tr bgcolor= "#FFFFFF" >
<td align= "center" valign= "Middle" Bordercolor= "#999999" ><input
type= "Radio" name= "Returntag" value= "2" > National Network Bidding center </td>
</ Tr></form1>
The JS code is as follows:
function GetValue ()
{
//Gets the radio button value for
(Var i=0;i<form1.returntag.length;i++)
{
if ( form1.returntag[i].checked)
{
var returntagvalue=form1.returntag[i].value//Here is the radio button value
}
}
}
More readers interested in JavaScript-related content can view the site topics: "JavaScript Search Algorithm Skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and Skills summary", " A summary of JSON manipulation techniques in JavaScript, a summary of JavaScript switching effects and techniques, a summary of JavaScript animation effects and techniques, JavaScript errors and debugging tips, and a summary of JavaScript mathematical operational usage
I hope this article will help you with JavaScript programming.