RadioButtonList js获取选择的项

<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="0" Selected="True" Text="方向一" ></asp:ListItem>
<asp:ListItem Value="1" Text="方向二"></asp:ListItem>
<asp:ListItem Value="2" Text="方向三"></asp:ListItem>
<asp:ListItem Value="3" Text="方向四"></asp:ListItem>
</asp:RadioButtonList>

 

 

<script type="text/javascript"> 
function CheckIsSelected() { 
var rbl = document.getElementById("<%=RadioButtonListCosmetic.ClientID%>"); 
var radio = rbl.getElementsByTagName("input"); 
var isSelect = false; 
for (var i = 0; i < radio.length; i++) { 
if (radio[i].checked) { 
isSelect = true; 
break; 


if (!isSelect) { 
alert("请选择一个选项。"); 

return isSelect; 

</script> 

posted @ 2015-08-08 15:31  ChineseMoonGod  阅读(369)  评论(0编辑  收藏  举报