Problems solved in today's project: JS checks whether the Radio radio button is selected and displays the value information. The Radio value is not always obtained at first, and later finds some logic problems, I would like to share this code to take notes and share it with my colleagues who have encountered such problems:
[Javascript]
<Script type = "text/javascript">
// Judge the five Radio functions that are selected
Function judgeRadioClicked ()
{
// Obtain the name set of the single-choice button
Var radios = document. getElementsByName ("radio_tj ");
// Traverse the name set based on the length of the name set
For (var I = 0; I <radios. length; I ++)
{
// Determine which radio button is selected
If (radios [I]. checked)
{
// The value of the selected radio button is displayed.
Alert (radios [I]. value );
}
}
}
</Script>
Note: // obtain the name set of the single-choice button // var radios = document. getElementsByName ("radio_tj"); "radio_tj" indicates the name attribute of the single-choice button set.
Over !!!
From SongYanJun2011