[原创]如何得到RadioButtonList 中的选中值
1<asp:RadioButtonList id="RadioButtonList1" style="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 144px"
2 runat="server">
3 <asp:ListItem Value="a" >a</asp:ListItem>
4 <asp:ListItem Value="b" Selected="True">b</asp:ListItem>
5 <asp:ListItem Value="c">c</asp:ListItem>
6 </asp:RadioButtonList>
2 runat="server">
3 <asp:ListItem Value="a" >a</asp:ListItem>
4 <asp:ListItem Value="b" Selected="True">b</asp:ListItem>
5 <asp:ListItem Value="c">c</asp:ListItem>
6 </asp:RadioButtonList>
1 <script language="javascript">
2 function getRadio()
3 {
4 var opts = document.all("RadioButtonList1");
5 if (opts)
6 {
7 for (var i = 0; i < opts.length; i++)
8 {
9 if (opts[i].checked)
10 {
11 alert(i);
12 break;
13 }
14 }
15 }
16 }
17 getRadio();
18
19 </script>
2 function getRadio()
3 {
4 var opts = document.all("RadioButtonList1");
5 if (opts)
6 {
7 for (var i = 0; i < opts.length; i++)
8 {
9 if (opts[i].checked)
10 {
11 alert(i);
12 break;
13 }
14 }
15 }
16 }
17 getRadio();
18
19 </script>