日期:2014-05-17  浏览次数:20520 次

asp.net如何实现部分全选
如图:这是怎么实现的?


------解决方案--------------------
function CheckAll(strname,allname)
{
//debugger;
//var frm = document.getElementById("form1");
var frm=document.forms["form1"];
for (var i=0;i<frm.elements.length;i++)
{
var e = frm.elements[i];
if (e.name != allname && e.disabled!=true && e.name == strname)
{
if(allname=='chkall'){
e.checked = frm.chkall.checked;
}
if(allname=='chkall2'){
e.checked = frm.chkall2.checked;
}
if(allname=='chkall3'){
e.checked = frm.chkall3.checked;
}
if(allname=='chkall4'){
e.checked = frm.chkall4.checked;
}
if(allname=='chkall5'){
e.checked = frm.chkall5.checked;
}
if(allname=='chkall6'){
e.checked = frm.chkall6.checked;
}
}
}
}
把几个栏目归成几类
<ul class="checkul">
<li><input name="chkall" onclick="CheckAll('cbId1','chkall')" title="选中/不选中" type="checkbox" value="chkall" />全部選取</li>
<li><input type="checkbox" id="Checkbox7" name="cbId1" value='<%# Eval("C_Id") %>'/></li></ul>

<ul class="checkul">
<li><input name="chkall2" onclick="CheckAll('cbId2','chkall2')" title="选中/不选中" type="checkbox" value="chkall" />全部選取</li>
<li><input type="checkbox" id="Checkbox8" name="cbId2" value='<%# Eval("C_Id") %>'/></li></ul>