復制代碼 代碼如下:
function ValidateCheckBox(sender, args) {
var checkbox = document.getElementById("<%=CheckBox1.ClientID %>")
if (checkbox.checked) {
args.IsValid = true;
}
else {
args.IsValid = false;
}
}
復制代碼 代碼如下:
<asp:CheckBox runat="server" />
<asp:CustomValidator runat="server" ErrorMessage="必須選擇選項" ForeColor="Red" ClientValidationFunction="ValidateCheckBox"></asp:CustomValidator><br />
<asp:Button runat="server" Text="提交" />
新聞熱點
疑難解答
圖片精選