javascript 数据库取数据 全选和反选
2010-05-04 19:48
253 查看
javascript所对应的全选和反选 。操作数据库记录。
以下是页面代码:
所对应的javascript代码如下:
可以实现全选和反选。
以下是页面代码:
<tr> <td colspan="6" width="100%"> <table border="2" width="100%"> <tr class="center"> <th width="20%" class="center"> 全选/反选<input type="checkbox" name="all" onclick="ckeckAll(this);"> </th> <th width="20%" class="center"> 箱主 </th> <th width="20%" class="center"> 箱号 </th> <th width="20%" class="center"> 箱型 </th> <th width="20%" class="center"> 箱类 </th> </tr> <tbody id="listTable"> <logic:iterate id="ylxhlist" name="lssqdListForm" property="ylxhlist" indexId="index"> <% int i=index.intValue(); %> <tr> <th width="20%" class="center"> <html:checkbox property="checkbox1" name="ylxhlist" value="true" indexed="true"/> <html:hidden name="ylxhlist" property="id" indexed="true" /> <html:hidden name="ylxhlist" property="zbid" indexed="true" /> <html:hidden name="ylxhlist" property="xxdm" indexed="true" /> <html:hidden name="ylxhlist" property="xldm" indexed="true" /> <html:hidden name="ylxhlist" property="ztmc" indexed="true" /> <html:hidden name="ylxhlist" property="ztid" indexed="true" /> </th> <td width="20%" class="center"> <bean:write name="ylxhlist" property="xzdm" /> <html:hidden name="ylxhlist" property="xzdm" indexed="true" /> </td> <td width="20%" class="center"> <bean:write name="ylxhlist" property="xhdm" /> <html:hidden name="ylxhlist" property="xhdm" indexed="true" /> </td> <td width="20%" class="center"> <bean:write name="ylxhlist" property="xxmc" /> <html:hidden name="ylxhlist" property="xxmc" indexed="true" /> </td> <td width="20%" class="center"> <bean:write name="ylxhlist" property="xlmc" /> <html:hidden name="ylxhlist" property="xlmc" indexed="true" /> </td> </tr> </logic:iterate> </tbody> </table> </td> </tr>
所对应的javascript代码如下:
//全选。 function ckeckAll(obj){ var checkboxs = document.getElementsByName("all"); var ob = document.getElementById("listTable"); for ( var i = 0; i < ob.rows.length; i++) { var oTr = ob.children[i]; var oCheckbox = oTr.children[0].children[0]; if(obj.checked){ oCheckbox.checked=true; }else{ oCheckbox.checked=false; } } }
可以实现全选和反选。
相关文章推荐
- javascript连接数据库并读取数据
- javaScript实现复选框的全选反选事件
- Javascript+XMLHttpRequest+asp.net无刷新读取数据库数据
- javascript之checkbox全选反选功能实现
- 本人改编的“javascript动态添加表格数据行,ASP后台数据库保存例子”
- 将数据库中的数据通过 client 控件显示 (一个asp和javascript传参数的列子)
- javascript实现全选反选操作并完成删除
- 利用javascript从数据库取数据来实现CSDN首页图片的切换效果
- Javascript实现复选框(全选反选功能)
- AngularJS表格数据全选反选批量删除,删除的数据添加到数组里
- JavaScript--点击按钮实现复选框全选和反选功能
- 通过JavaScript在html上动态刷新从数据库中读出来的数据
- 将数据库中的数据通过 client 控件显示 (一个asp和javascript传参数的列子)
- 基于JavaScript实现全选、不选和反选效果
- JavaScript中复选框的全选和反选功能的实现
- javascript实现全选反选取消所选
- JavaScript学习笔记---全选反选示例
- 帮助你使用数据库方式访问JSON数据的javascript类库-TaffyDB
- javascript实现可全选、反选及删除表格的方法
- 使用joomla通过CSV文件上传数据存入数据库并使用JavaScript验证码是否符合规则