<table class="table table-striped sortable table-bordered table-hover " id="zdnews"> <thead> <tr> <th>運單號</th> <th>發貨人</th> <th>收貨人</th> <th>貨物信息</th> <th id="payxf"><input type="checkbox" class="zdcheckbox">現付</th> <th id="payxf1"><input type="checkbox" class="zdcheckbox">到付</th> <th id="payxf2"><input type="checkbox" class="zdcheckbox">月結</th> <th id="payxf3"><input type="checkbox" class="zdcheckbox">回執付</th> <th id="payxf4"><input type="checkbox" class="zdcheckbox">返廠付</th> <th >匯總費用</th> </tr> </thead> <tbody> <tr> <td> <a href="ddlook.html">100adggg3253445345454</a> <br></td> <td>俞亮 <br>山西省臨汾市</td> <td>匿名 <br>黑龍江省佳木斯市樺南縣</td> <td>龍岩,435件,127千克,32方</td> <td><input type="checkbox" class="zdcheckbox">100</td> <td><input type="checkbox" class="zdcheckbox">50</td> <td><input type="checkbox" class="zdcheckbox">10</td> <td><input type="checkbox" class="zdcheckbox">20</td> <td><input type="checkbox" class="zdcheckbox">30</td> <td><span class="colorred ">0</span></td> </tr> <tr> <td> <a href="ddlook.html">20adggg3253445345454</a> <br></td> <td>俞亮 <br>山西省臨汾市侯馬市</td> <td>匿名 <br>黑龍江省佳木斯市樺南縣</td> <td>龍岩,435件,127千克,32方</td> <td><input type="checkbox" class="zdcheckbox">20</td> <td><input type="checkbox" class="zdcheckbox">30</td> <td><input type="checkbox" class="zdcheckbox">40</td> <td><input type="checkbox" class="zdcheckbox">50</td> <td><input type="checkbox" class="zdcheckbox">60</td> <td><span class="colorred ">0</span></td> </tr> <tr> <td> <a href="ddlook.html">40adggg3253445345454</a> <br></td> <td>俞亮 <br>山西省臨汾市侯馬市</td> <td>匿名 <br>黑龍江省佳木斯市樺南縣</td> <td>龍岩,435件,127千克,32方</td> <td><input type="checkbox" class="zdcheckbox">40</td> <td><input type="checkbox" class="zdcheckbox">10</td> <td><lable><input type="checkbox" class="zdcheckbox">20</td> <td><input type="checkbox" class="zdcheckbox">30</td> <td><input type="checkbox" class="zdcheckbox">50</td> <td><span class="colorred ">0</span></td> </tr> </tbody> </table>
<script> //現付 $("#payxf").bind("click",function () { if ($(this).hasClass("checkth")) { $("#zdnews tr").each(function(){ $(this).find('td').eq(4).find(':checkbox').attr('checked',false); $(this).find('th').eq(4).find(':checkbox').attr('checked',false); $(this).find('td').eq(4).removeClass("checkth"); $(this).find('th').eq(4).removeClass("checkth"); }) } else { $("#zdnews tr").each(function(){ $(this).find('td').eq(4).find(':checkbox').attr('checked',true); $(this).find('th').eq(4).find(':checkbox').attr('checked',true); $(this).find('td').eq(4).addClass('checkth'); $(this).find('th').eq(4).addClass('checkth'); }) } }); //到付 $("#payxf1").bind("click",function () { if ($(this).hasClass("checkth")) { $("#zdnews tr").each(function(){ $(this).find('td').eq(5).find(':checkbox').attr('checked',false); $(this).find('th').eq(5).find(':checkbox').attr('checked',false); $(this).find('td').eq(5).removeClass("checkth"); $(this).find('th').eq(5).removeClass("checkth"); }) } else { $("#zdnews tr").each(function(){ $(this).find('td').eq(5).find(':checkbox').attr('checked',true); $(this).find('th').eq(5).find(':checkbox').attr('checked',true); $(this).find('td').eq(5).addClass('checkth'); $(this).find('th').eq(5).addClass('checkth'); }) } }); //月結 $("#payxf2").bind("click",function () { if ($(this).hasClass("checkth")) { $("#zdnews tr").each(function(){ $(this).find('td').eq(6).find(':checkbox').attr('checked',false); $(this).find('th').eq(6).find(':checkbox').attr('checked',false); $(this).find('td').eq(6).removeClass("checkth"); $(this).find('th').eq(6).removeClass("checkth"); }) } else { $("#zdnews tr").each(function(){ $(this).find('td').eq(6).find(':checkbox').attr('checked',true); $(this).find('th').eq(6).find(':checkbox').attr('checked',true); $(this).find('td').eq(6).addClass('checkth'); $(this).find('th').eq(6).addClass('checkth'); }) } }); //回執付 $("#payxf3").bind("click",function () { if ($(this).hasClass("checkth")) { $("#zdnews tr").each(function(){ $(this).find('td').eq(7).find(':checkbox').attr('checked',false); $(this).find('th').eq(7).find(':checkbox').attr('checked',false); $(this).find('td').eq(7).removeClass("checkth"); $(this).find('th').eq(7).removeClass("checkth"); }) } else { $("#zdnews tr").each(function(){ $(this).find('td').eq(7).find(':checkbox').attr('checked',true); $(this).find('th').eq(7).find(':checkbox').attr('checked',true); $(this).find('td').eq(7).addClass('checkth'); $(this).find('th').eq(7).addClass('checkth'); }) } }); //返廠付 $("#payxf4").bind("click",function () { if ($(this).hasClass("checkth")) { $("#zdnews tr").each(function(){ $(this).find('td').eq(8).find(':checkbox').attr('checked',false); $(this).find('th').eq(8).find(':checkbox').attr('checked',false); $(this).find('td').eq(8).removeClass("checkth"); $(this).find('th').eq(8).removeClass("checkth"); }) } else { $("#zdnews tr").each(function(){ $(this).find('td').eq(8).find(':checkbox').attr('checked',true); $(this).find('th').eq(8).find(':checkbox').attr('checked',true); $(this).find('td').eq(8).addClass('checkth'); $(this).find('th').eq(8).addClass('checkth'); }) } }); // 單個選擇 $("#zdnews tbody tr").each(function(){ $(this).find('td').bind("click",function () { if ($(this).hasClass("checkth")) { $(this).find(':checkbox').attr('checked',false); $(this).removeClass("checkth"); } else { $(this).find(':checkbox').attr('checked',true); $(this).addClass('checkth'); } }); // }) </script>