table中checkbox选择多行
页面代码
<table id="addressTable" class="ui-jqgrid-htable ui-common-table table table-bordered">
<thead>
<tr>
<td style='text-align:center;width:35px;'><input id="selectAll" role='checkbox' type='checkbox' class='cbox checkbox' /></td>
<td>名称</td><td>地址</td><td>联系人</td><td>电话</td><td>操作</td>
</tr>
</thead>
<tbody id="tbody">
<tr>
<td style="text-align:center;width:35px;">
<input role="checkbox" type="checkbox" class="cbox checkbox">
</td>
<td>明十三陵</td><td>北京市市辖区昌平区天寿山麓</td><td>崇祯</td><td>18903378092</td>
<td><a onclick="updateItem(this)">修改</a><a onclick="deleteItem(this)">删除</a></td>
</tr>
<tr>
<td style="text-align:center;width:35px;">
<input role="checkbox" type="checkbox" class="cbox checkbox">
</td>
<td>1多福多寿</td><td>福建省龙岩市连城县八王坟</td><td>2</td><td>18903378092</td>
<td><a onclick="updateItem(this)">修改</a> <a onclick="deleteItem(this)">删除</a></td>
</tr>
</tbody>
</table>
js代码
$(function() {
$("#selectAll").change(function() {
var checkboxs = $("#tbody").find("input[type='checkbox']");
var isChecked = $(this).is(":checked");
//严禁使用foreach,jq对象的遍历会使浏览器崩溃
for(var i = 0; i < checkboxs.length; i++) {
//临时变量,必须,否则只能选中最后一条记录
var temp = i;
$(checkboxs[temp]).prop("checked",isChecked);
}
});
});
table中checkbox选择多行的更多相关文章
- cocos2dx2.2.2登录场景中Checkbox选择框的实现
在前两篇文章中,我们介绍了在注册场景中需要用到的输入框及弹出框的实现方式,这两篇文章中介绍的内容在登录场景同样会用到.而我们经常会在登录场景中见到的另一种元素就是自动登录或者记住密码的Checkbox ...
- 实现table中checkbox复选框、以及判断checked是否被选中、js操作checkedbox选中
上图是实现效果. 下面贴代码 表的第一行也就是<th>中的代码,onclick事件是实现全选或者全不选效果. <th> <input id="allboxs&q ...
- 怎样实现在DBGrid中双击选择整行,并且可以多选?谢谢!!
DBGrid1->Options里有个dgMultiSelect,把它设为true就能多选了 先设置DBGrid1->options中dgRowSelect = true, dgMulti ...
- 获取table中CheckBox选中行的id
方式一 var selectList=''; jQuery(".table tbody input[type=checkbox]:checked").map(function () ...
- angularJS处理table中checkbox的选中状态
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- easyui DataGrid 的 Checkbox 选择多行
这么一来在取得 DataGrid 的 Checkbox 有勾选的数据值就可以沿用方式一的程序, 1.$('#ButonGetCheck').click(function(){ 2.var checke ...
- 在dbgrideh中允许选择多行,如何知道哪些行被选中
是个BOOKMARK类型的属性. SelectedRows: TBookmarkList procedure TForm1.Button1Click(Sender: TObject); var i, ...
- JQuery中Checkbox选择
判断是否选中 $(this).is(":checked") 取消选中 $(this).prop("checked", false) 选中 $(this).pro ...
- layui table 中固定列的行高和table行高不一致
解决方法:只需在done回调函数执行以下方法 done: function(res, curr, count){ $(".layui-table-main tr").each(fu ...
随机推荐
- MUI 页面跳转(传值+接收)
官方:做web app,一个无法避开的问题就是转场动画:web是基于链接构建的,从一个页面点击链接跳转到另一个页面, 如果通过有刷新的打开方式,用户要面对一个空白的页面等待: 如果通过无刷新的方式,用 ...
- java高级---->Thread之CountDownLatch的使用
CountDownLatch是JDK 5+里面闭锁的一个实现,允许一个或者多个线程等待某个事件的发生.今天我们通过一些实例来学习一下它的用法. CountDownLatch的简单使用 CountDow ...
- Request.getRequestURL
getRequestURI()就相当于你在写一个JSP页面的时候会有这样的东西"action='/WebRoot/xxx'"这个方法就是获得'/WebRoot/xxx',也就是说它 ...
- 实用的IOS应用程序框架
实用的IOS应用程序框架 目录 概述 概述
- ios UIImage图片拉伸 resizableImageWithCapInsets:
常见的按钮添加和背景设置如下: UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(80, 130, 160, 44)];[bu ...
- 几何+点与线段的位置关系+二分(POJ2318)
TOYS Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10666 Accepted: 5128 Description ...
- SpringBoot SpringApplication底层源码分析与自动装配
目录 抛出问题 @SpringBootApplication注解剖析 SpringApplication类剖析 第一步:配置SpringBoot Bean来源 第二步 :自动推断SpringBoot的 ...
- HOJ 2139 Spiderman's workout(动态规划)
Spiderman's workout My Tags (Edit) Source : Nordic Collegiate Programming Contest 2003 Time limit : ...
- Allocation Sinking Optimization
LuaJIT Sponsorship Program http://luajit.org/sponsors.html Sponsorship for allocation/store sinking ...
- talib 中文文档(七):Overlap Studies Functions
Overlap Studies Functions 重叠指标 BBANDS - Bollinger Bands 函数名:BBANDS 名称: 布林线指标 简介:其利用统计原理,求出股价的标准差及其信赖 ...