checkbox全选和全反选
来源:互联网 发布:喝假酒的fa 淘宝店铺 编辑:程序博客网 时间:2024/05/15 04:42
<script language="javascript">
///设置全选
function SelectAllCheckboxes(spanChk,chkboxname){
var oItem = spanChk.children;
var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
xState=theBox.checked;
elm=theBox.form.elements;
for(i=0;i<elm.length;i++)
if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
{
if(elm[i].checked!=xState && elm[i].id.indexOf(chkboxname) != -1)
elm[i].click();
}
document.getElementById("chkAllreverse").checked=false;
}
///设置反选
function SelectReverseChekboxes(spanChk,chkboxname){
var oItem = spanChk.children;
var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];
xState=theBox.checked;
elm=theBox.form.elements;
for(i=0;i<elm.length;i++)
if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
{
if( elm[i].id.indexOf(chkboxname) != -1)
elm[i].click();
}
document.getElementById("chkAll").checked=false
}
</script>
==========================================================
<input id="chkAll" runat="server" onclick="javascript:SelectAllCheckboxes(this,'sel');" type="checkbox" />全选
<input id="chkAllreverse" runat="server" onclick="javascript:SelectReverseChekboxes(this,'sel');" type="checkbox">反选
==========================================================
注:
sel 是 gridlist 中的 checkbox名
chkAll 是全选checkbox
chkAllreverse 是全反选checkbox
- checkbox全选和全反选
- checkbox全选和取消全选
- checkbox 全选和取消全选
- Checkbox 全选和取消全选的代码
- JQuery实现checkbox全选和取消全选
- checkbox的全选和不全选
- checkbox全选,反选和取消全选
- checkbox全选和反选
- Js checkbox全选和全不选
- checkbox全选和反选
- checkbox全选和反选
- checkbox全选和反选
- checkbox 全选和反选
- checkbox全选和反选
- Checkbox全选和反选
- checkbox全选和全部选
- HTML 复选框 checkbox 的 JavaScript 的全选和全反选
- checkbox全选和取消全选(100%可以全选和取消全选)
- JavaScript去除空格的三种方法 (trim)
- .net 用C# 开发系统托盘程序
- C# listview之点击空白区仍然不失去选中项的状态
- Linux系统下如何查看及修改文件读写权限
- 关于PL/SQL中复杂的存储过程或者是函数等的查询==避免在PL/SQL当中写SQL语句查询存储过程或者是函数
- checkbox全选和全反选
- ==与equals的区别
- 开启和关闭LINUX 放火墙的命令
- Compizconfig-settings-manager 开启桌面立方体
- 生成静态网页
- test
- 常用的几个正则表达式
- xxxx
- AgilePoint 進階篇