62,074
社区成员
发帖
与我相关
我的任务
分享
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function Button1_onclick() {
var contaninerID = document.getElementById("<%=CheckBoxList1.ID %>");
var boxs = contaninerID.getElementsByTagName("input")
for (i = 0; i < boxs.length; i++) {
alert(boxs[i].checked);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:CheckBoxList ID="CheckBoxList1" runat="server" RepeatDirection="Horizontal"
RepeatLayout="Flow">
<asp:ListItem>A</asp:ListItem>
<asp:ListItem>B</asp:ListItem>
</asp:CheckBoxList>
</form>
<p>
<input id="Button1" type="button" value="button" onclick="return Button1_onclick()" /></p>
</body>
</html>