<<CODE class="htmlkeyword">asp:RadioButtonList
ID="RadioButtonList1" runat="server">
<</CODE>asp:ListItem Value="A">a</</CODE>asp:ListItem> <</CODE>asp:ListItem Value="B">b</</CODE>asp:ListItem> </</CODE>asp:RadioButtonList> <</CODE>asp:RadioButtonList ID="RadioButtonList2" runat="server"> <</CODE>asp:ListItem Value="C">c</</CODE>asp:ListItem> <</CODE>asp:ListItem Value="D">d</</CODE>asp:ListItem> </</CODE>asp:RadioButtonList> <</CODE>input type="button" onclick="check();" value="提交" />
"text/javascript">
function check() { if ($("#RadioButtonList1 input[name=RadioButtonList1]:not(:checked)").length > 1 || $("#RadioButtonList2 input[name=RadioButtonList2]:not(:checked)").length > 1) { alert('没做完'); } else { alert("做完了"); } }
本文介绍如何使用ASP.NET中的RadioButtonList控件,并结合JavaScript进行表单验证,确保所有RadioButtonList都有选项被选中。提供了完整的代码示例。
1万+

被折叠的 条评论
为什么被折叠?



