check单选框多个全选与取消全选
2024-09-24 09:57:55
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table class="table_lists">
<tbody>
<tr>
<td width="40"><input type="checkbox" value="A00" class="cbx_child" name="level" /></td>
<td width="100"><b>统计概览</b></td>
<td> </td>
</tr>
<tr>
<td width="40"><input type="checkbox" value="A01" class="cbx_child" name="level" /></td>
<td width="100"><b>文档管理</b></td>
<td> <span class="res_classify"><input type="checkbox" id="A0101" value="A0101" class="cbx_child_and" name="level" /><label for="A0101">添加文档</label></span> <span class="res_classify"><input type="checkbox" id="A0102" value="A0102" class="cbx_child_and" name="level" /><label for="A0102">修改任意文档</label></span> <span class="res_classify"><input type="checkbox" id="A0103" value="A0103" class="cbx_child_and" name="level" /><label for="A0103">审核文档</label></span> <span class="res_classify"><input type="checkbox" id="A0104" value="A0104" class="cbx_child_and" name="level" /><label for="A0104">移动文档</label></span> <span class="res_classify"><input type="checkbox" id="A0105" value="A0105" class="cbx_child_and" name="level" /><label for="A0105">复制文档</label></span> <span class="res_classify"><input type="checkbox" id="A0106" value="A0106" class="cbx_child_and" name="level" /><label for="A0106">删除文档</label></span> <span class="res_classify"><input type="checkbox" id="A0107" value="A0107" class="cbx_child_and" name="level" /><label for="A0107">清空文档</label></span> </td>
</tr>
<tr>
<td width="40"><input type="checkbox" value="A02" class="cbx_child" name="level" /></td>
<td width="100"><b>分类管理</b></td>
<td> <span class="res_classify"><input type="checkbox" id="A0201" value="A0201" class="cbx_child_and" name="level" /><label for="A0201">添加分类</label></span> <span class="res_classify"><input type="checkbox" id="A0202" value="A0202" class="cbx_child_and" name="level" /><label for="A0202">修改分类</label></span> <span class="res_classify"><input type="checkbox" id="A0203" value="A0203" class="cbx_child_and" name="level" /><label for="A0203">删除分类</label></span> </td>
</tr>
</tbody>
</table>
<script src="jquery-1.8.3.min.js"></script>
<script>
$(function(){
$('input.cbx_child').change(function(){
var cbx_child_and = $(this).parent().siblings().find('input');
$(this).prop('checked')?cbx_child_and.prop('checked',true):cbx_child_and.prop('checked',false);
});
$('input.cbx_child_and').change(function(){
if($(this).prop('checked')){
$(this).prop('checked',true).parents('td').siblings().children('.cbx_child').prop('checked',true);
}
else{
if($(this).parents('td').find("input:checked").length==0){
$(this).parents('td').siblings().children('.cbx_child').prop('checked',false);
}
}
});
});
</script>
</body>
</html>
最新文章
- 【转】 C++使用zlib库(-)
- HDU 5001
- Spring---Web MVC关于前台传值转换问题
- asp.net中ScriptManager自带Ajax与jQuery事件冲突
- WPF Radio组的绑定
- Java 8 中新的 Date 和 Time 类入门详解
- [Swust OJ 188]--异面空间(读懂题意很重要)
- SublimeText编辑器替代notepad++了
- 兔子与樱花[HEOI2015]
- C#参数详解
- python web框架之Tornado
- phpcms的验证码替换 及 phpcms实现全站搜索功能
- Ubuntu 16.06 安装拼音输入法 设置双拼
- 【Python3爬虫】最新的模拟登录新浪微博教程
- January 14th, 2018 Week 02nd Sunday
- HTML DOM 学习笔记
- mysql 架构~MGR监控手段
- MongoDB 分布式部署教程
- Roslyn编译器-C#动态脚本实现方案
- Python3.5 学习九