<html > <head> <title>checkbox全选</title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <style type="text/css"></style> <script type="text/javascript"></script> </head> <body> <table> <tr> <th> <input type='checkbox' value='checkbox' /> 全选 </th> <th>商品编号</th> <th>名称</th> <th>标题</th> <th>品牌</th> <th>组别</th> </tr> <tr> <td> <input type='checkbox' value='{id}'> </td> <td>001</td> <td>002</td> <td>003</td> <td>004</td> <td>005</td> </tr> <tr> <td> <input type='checkbox' value='{id}'> </td> <td>001</td> <td>002</td> <td>003</td> <td>004</td> <td>005</td> </tr> <tr> <td colspan="10"> <input type="button" value="批量展示"> </td> </tr> </table> <script type="text/javascript" src="https://www.jb51.net/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="https://www.jb51.net/checkbox.js"></script> <script type="text/javascript"> /*var ids = []; $('#btn_show').click(function(){ btnCheck('展示'); data = { "ids":ids }; $.ajax({ type:"POST", url:"{:U('Mall/GoodsShow')}", data:data, //dataType:"json", success:function(msg){ if(msg == 00){ alert("批量展示成功"); window.location.href='/index.php/Admin/Mall/MallList'; }else{ alert("批量展示失败,请重新编辑"); } }, error:function(){ alert("批量编辑失败,请重新编辑"); } }); }); function btnCheck(info){ var obj = $("input[name='id[]']:checked").each(function(){ ids.push($(this).val()); }); if (ids == false) { alert("请选定要"+info+"的商品"); return false; }else { return ids; } } */ </script> </body> </html>
基于js实现checkbox批量选中操作
内容版权声明:除非注明,否则皆为本站原创文章。