<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="eachcheckbox.aspx.cs" Inherits="WebApplication1.eachcheckbox" %> <!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 src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript"> $(function () {
var cnt = ;
var sel = '';
$("#btnclick").click(function () {
//debugger;
var items = jQuery("input:checked[guid]");
items.each(function () {
if (jQuery(this).attr("guid")) { sel += "," + jQuery(this).attr("guid");
cnt += ;
}
else { }
}); if (cnt < ) {
alert('请选择记录!');
return false;
} else {
// if (confirm('确定要删除吗?')) {
alert(sel);
// }
}
sel = ""; });//获取选中的是哪一个 $("#chkIsPublic").click(function () { //对单选按钮单击
var ss = $('input:radio:checked').val();
alert(ss);
});
}); //复选框全选
function aa(obj) { $(".checkBox>input").attr("checked", $(obj).attr("checked"));
$(".checkBox").attr("checked", $(obj).attr("checked"));
} </script>
</head>
<body>
<form id="form1" runat="server">
<input type="button" id="btnclick" value="获取选中的是哪一个" /> <div>
<table>
<tr>
<td colspan=""><input type="checkbox" id="checkAll" onclick="aa(this)" />全选</td>
</tr>
<tr>
<td>
<input type="checkbox" id="chkguid" guid="class1" class="checkBox" />班级1
</td>
<td>
<input type="checkbox" id="Checkbox1" guid="class2" class="checkBox" />班级2
</td>
<td>
<input type="checkbox" id="Checkbox2" guid="class3" class="checkBox" />班级3
</td>
</tr>
</table>
</div>
<div>
----------------------------------------------------------------------------------------------
</div>
<asp:RadioButtonList ID="chkIsPublic" runat="server" RepeatDirection="Horizontal"
RepeatLayout="Flow" RepeatColumns="">
<asp:ListItem Value="" Selected="True">租赁</asp:ListItem>
<asp:ListItem Value="">购买</asp:ListItem>
<asp:ListItem Value="">代理商</asp:ListItem>
</asp:RadioButtonList>
</form>
</body>
</html>