1 //反选、计算 2 function trCheck(id,name,obj){ 3 if($("input[name='check']").length== $("input[name='check']:checked").length){ 4 $("input[name='all-check']").attr("checked",true) 5 }else{ 6 $("input[name='all-check']").attr("checked",false) 7 } 8 // if( $("input[name='check']").length== $("input[name='check']:not(:checked)").length){ 9 // $("input[name='all-check']").attr("checked",false) 10 // } 11 if($(obj).attr("checked")=='checked'){ 12 window.parent.getpageName(id,name); 13 }else{ 14 window.parent.remveData(id,name); 15 } 16 }
1 <table class="table table-bordered"> 2 <thead> 3 <tr> 4 <th> 5 <div class="checkbox checkbox-danger"> 6 <input type="checkbox" name="all-check" class="styled" onclick="selectCheck(this)"/> 7 <label class="checkbox-inline"></label> 8 </div> 9 </th> 10 <th>姓名</th> 11 <th>性别</th> 12 <th>手机</th> 13 <th>职务</th> 14 </tr> 15 </thead> 16 <tbody> 17 <c:forEach items="${page.list}" var="voterRegister" varStatus="var"> 18 <tr id="my"> 19 <th scope="row"> 20 <div class="checkbox checkbox-danger"> 21 <input type="checkbox" name="check" value="${voterRegister.id},${voterRegister.name}" onclick="trCheck('${voterRegister.id}','${voterRegister.name}',this)" class="styled" rowid="${voterRegister.id}"/> 22 <label class="checkbox-inline"></label> 23 </div> 24 </th> 25 <%-- <td style="cursor:pointer;" onclick="appendName('${voterRegister.id}','${voterRegister.name}')">${voterRegister.name}</td> 26 <td style="cursor:pointer;" onclick="appendName('${voterRegister.id}','${voterRegister.name}')">${voterRegister.colA}</td> --%> 27 <td style="cursor:pointer;">${voterRegister.name}</td> 28 <td style="cursor:pointer;">${fns:getDictLabels(voterRegister.sex, "sex", "未填写")}</td> 29 <td>${voterRegister.phone}</td> 30 <td>${voterRegister.occupation}</td> 31 </tr> 32 </c:forEach> 33 </tbody> 34 </table>