table中列复选框全选,再选 效果
<table class="table table-striped sortable table-bordered table-hover " id="zdnews">
<thead>
<tr>
<th>运单号</th>
<th>发货人</th>
<th>收货人</th>
<th>货物信息</th>
<th id="payxf"><input type="checkbox" class="zdcheckbox">现付</th>
<th id="payxf1"><input type="checkbox" class="zdcheckbox">到付</th>
<th id="payxf2"><input type="checkbox" class="zdcheckbox">月结</th>
<th id="payxf3"><input type="checkbox" class="zdcheckbox">回执付</th>
<th id="payxf4"><input type="checkbox" class="zdcheckbox">返厂付</th>
<th >汇总费用</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="ddlook.html">100adggg3253445345454</a>
<br></td>
<td>俞亮
<br>山西省临汾市</td>
<td>匿名
<br>黑龙江省佳木斯市桦南县</td>
<td>龙岩,435件,127千克,32方</td>
<td><input type="checkbox" class="zdcheckbox">100</td>
<td><input type="checkbox" class="zdcheckbox">50</td>
<td><input type="checkbox" class="zdcheckbox">10</td>
<td><input type="checkbox" class="zdcheckbox">20</td>
<td><input type="checkbox" class="zdcheckbox">30</td>
<td><span class="colorred ">0</span></td>
</tr>
<tr>
<td>
<a href="ddlook.html">20adggg3253445345454</a>
<br></td>
<td>俞亮
<br>山西省临汾市侯马市</td>
<td>匿名
<br>黑龙江省佳木斯市桦南县</td>
<td>龙岩,435件,127千克,32方</td>
<td><input type="checkbox" class="zdcheckbox">20</td>
<td><input type="checkbox" class="zdcheckbox">30</td>
<td><input type="checkbox" class="zdcheckbox">40</td>
<td><input type="checkbox" class="zdcheckbox">50</td>
<td><input type="checkbox" class="zdcheckbox">60</td>
<td><span class="colorred ">0</span></td>
</tr>
<tr>
<td>
<a href="ddlook.html">40adggg3253445345454</a>
<br></td>
<td>俞亮
<br>山西省临汾市侯马市</td>
<td>匿名
<br>黑龙江省佳木斯市桦南县</td>
<td>龙岩,435件,127千克,32方</td>
<td><input type="checkbox" class="zdcheckbox">40</td>
<td><input type="checkbox" class="zdcheckbox">10</td>
<td><lable><input type="checkbox" class="zdcheckbox">20</td>
<td><input type="checkbox" class="zdcheckbox">30</td>
<td><input type="checkbox" class="zdcheckbox">50</td>
<td><span class="colorred ">0</span></td>
</tr> </tbody>
</table>
<script>
//现付
$("#payxf").bind("click",function () {
if ($(this).hasClass("checkth")) {
$("#zdnews tr").each(function(){
$(this).find('td').eq(4).find(':checkbox').attr('checked',false);
$(this).find('th').eq(4).find(':checkbox').attr('checked',false);
$(this).find('td').eq(4).removeClass("checkth");
$(this).find('th').eq(4).removeClass("checkth");
})
} else {
$("#zdnews tr").each(function(){
$(this).find('td').eq(4).find(':checkbox').attr('checked',true);
$(this).find('th').eq(4).find(':checkbox').attr('checked',true);
$(this).find('td').eq(4).addClass('checkth');
$(this).find('th').eq(4).addClass('checkth');
})
}
});
//到付
$("#payxf1").bind("click",function () {
if ($(this).hasClass("checkth")) {
$("#zdnews tr").each(function(){
$(this).find('td').eq(5).find(':checkbox').attr('checked',false);
$(this).find('th').eq(5).find(':checkbox').attr('checked',false);
$(this).find('td').eq(5).removeClass("checkth");
$(this).find('th').eq(5).removeClass("checkth");
})
} else {
$("#zdnews tr").each(function(){
$(this).find('td').eq(5).find(':checkbox').attr('checked',true);
$(this).find('th').eq(5).find(':checkbox').attr('checked',true);
$(this).find('td').eq(5).addClass('checkth');
$(this).find('th').eq(5).addClass('checkth');
})
}
});
//月结
$("#payxf2").bind("click",function () {
if ($(this).hasClass("checkth")) {
$("#zdnews tr").each(function(){
$(this).find('td').eq(6).find(':checkbox').attr('checked',false);
$(this).find('th').eq(6).find(':checkbox').attr('checked',false);
$(this).find('td').eq(6).removeClass("checkth");
$(this).find('th').eq(6).removeClass("checkth");
})
} else {
$("#zdnews tr").each(function(){
$(this).find('td').eq(6).find(':checkbox').attr('checked',true);
$(this).find('th').eq(6).find(':checkbox').attr('checked',true);
$(this).find('td').eq(6).addClass('checkth');
$(this).find('th').eq(6).addClass('checkth');
})
}
});
//回执付
$("#payxf3").bind("click",function () {
if ($(this).hasClass("checkth")) {
$("#zdnews tr").each(function(){
$(this).find('td').eq(7).find(':checkbox').attr('checked',false);
$(this).find('th').eq(7).find(':checkbox').attr('checked',false);
$(this).find('td').eq(7).removeClass("checkth");
$(this).find('th').eq(7).removeClass("checkth");
})
} else {
$("#zdnews tr").each(function(){
$(this).find('td').eq(7).find(':checkbox').attr('checked',true);
$(this).find('th').eq(7).find(':checkbox').attr('checked',true);
$(this).find('td').eq(7).addClass('checkth');
$(this).find('th').eq(7).addClass('checkth');
})
}
});
//返厂付
$("#payxf4").bind("click",function () {
if ($(this).hasClass("checkth")) {
$("#zdnews tr").each(function(){
$(this).find('td').eq(8).find(':checkbox').attr('checked',false);
$(this).find('th').eq(8).find(':checkbox').attr('checked',false);
$(this).find('td').eq(8).removeClass("checkth");
$(this).find('th').eq(8).removeClass("checkth");
})
} else {
$("#zdnews tr").each(function(){
$(this).find('td').eq(8).find(':checkbox').attr('checked',true);
$(this).find('th').eq(8).find(':checkbox').attr('checked',true);
$(this).find('td').eq(8).addClass('checkth');
$(this).find('th').eq(8).addClass('checkth');
})
}
}); // 单个选择
$("#zdnews tbody tr").each(function(){
$(this).find('td').bind("click",function () {
if ($(this).hasClass("checkth")) {
$(this).find(':checkbox').attr('checked',false);
$(this).removeClass("checkth"); } else {
$(this).find(':checkbox').attr('checked',true);
$(this).addClass('checkth');
}
});
// })
</script>
table中列复选框全选,再选 效果的更多相关文章
- jQuery中的几个案例:隔行变色、复选框全选和全不选
1 表格隔行变色 1 技术分析: 1 )基本过滤选择器: odd: even: 2 )jq添加和移除样式: addClass(); removeClass(); 2 代码实现 <script s ...
- checkbox复选框全选批量删除
多选框全选实现批量删除 html代码 <body> <form action="" method="post" name="Form ...
- FineReport——JS二次开发(复选框全选)
在进行查询结果选择的时候,我们经常会用到复选框控件,对于如何实现复选框全选,基本思路: 在复选框中的初始化事件中把控件加入到一个全局数组里,然后在全选复选框里对数组里的控件进行遍历赋值. 首先,定义两 ...
- html+css+js实现复选框全选与反选
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...
- jQuery 复选框全选/取消全选/反选
jQuery实现的复选框全选/取消全选/反选及获得选择的值. 完整代码: <!DOCTYPE html> <html> <head> <script type ...
- js 判断 复选框全选、全不选、反选、必选一个
一个挺 使用的 js 代码片段, 判断 复选框全选.全不选.反选.必选一个 记录下, 搬来的 思路: 修改数据的 选中与否状态, 拿到所有的输入框,看是否有选中的状态 <html> & ...
- js 复选框 全选都选 如果某一个子复选框没选中 则全选按钮不选中
<!DOCTYPE HTML> <html> <head> <meta charset=UTF-8> <title>js 复选框 全选都选 ...
- JavaScript小例子:复选框全选
JavaScript小例子:复选框全选 这只是一个小例子,很简单,但是这个功能还是很常用的: 实现后效果如图: JavaScript代码: <script type="text/jav ...
- Jquery表格变色 复选框全选,反选
/*jquery静态表格变色*/ $(".tr2").mouseover(function(){ $(this).css("background"," ...
随机推荐
- Android Post方式发送信息和获取URL中的图片
需要Internet权限,AndroidManifest.xml <uses-permission android:name="android.permission.INTERNET& ...
- leetcode 18 4Sum JAVA
题目 给定一个包含 n 个整数的数组 nums 和一个目标值 target,判断 nums 中是否存在四个元素 a,b,c 和 d ,使得 a + b + c + d 的值与 target 相等?找出 ...
- react-dnd使用介绍
核心API 想要灵活使用,就先知道几个核心API DragSource 用于包装你需要拖动的组件,使组件能够被拖拽(make it draggable) DropTarget 用于包装接收拖拽元素的组 ...
- 51nod-迷宫问题(Dijkstra算法)
关于Dijkstra算法的博文 http://www.cnblogs.com/skywang12345/p/3711512.html#anchor2 Dijkstra算法是一个经典的算法——他是荷兰计 ...
- 洛谷P5158 【模板】多项式快速插值
题面 传送门 前置芝士 拉格朗日插值,多项式多点求值 题解 首先根据拉格朗日插值公式我们可以暴力\(O(n^2)\)插出这个多项式,然而这显然是\(gg\)的 那么看看怎么优化,先来看一看拉格朗日插值 ...
- sizeWithFont:的替代方法
sizeWithFont:的替代方法 -(CGFloat)changeStationWidth:(NSString *)string{ UIFont * textFont = [UIFont syst ...
- h5聊天工具的开发过程及思路
这个产品的主要技术栈有,网易nim即时通信,vue-cli,muse-ui 1.在拿到这个需求时,脑袋里空的,什么想法都没有,完全懵逼,进了网易云通信的官网api查看,由于我做的是客户端的,所以重点看 ...
- MySQL中optimize的作用
MySQL执行命令delete语句时,如果包括where条件,并不会真正的把数据从表中删除,而是将数据转换成了碎片,通过下面的命令可以查看表中的碎片数量和索引等信息: mysql > show ...
- C/C++入门易错点及常用小技巧
int型:绝对值在10^9范围内的整数都可以定义为int型 long long 型:如果long long型赋值大于2^23-1的初值,需要在初值后面加LL,否则会编译错误. float,double ...
- PHP错误与异常处理
https://www.cnblogs.com/zyf-zhaoyafei/p/6928149.html 请一定要注意,没有特殊说明:本例 PHP Version < 7 说起PHP异常处理,大 ...