<div class="codetitle"> <span><a style="CURSOR: pointer" data="65319" class="copybut" id="copybut65319" onclick="doCopy('code65319')"><u>複製代碼</u></a></span>代碼如下:</div> <div class="codebody" id="code65319"> <br> <br> <br> <br> <br> <br>$(document).ready(function() { <br>//全選/取消全部<br>$("#checkAllChange").click(function() { <br>if (this.checked = = true ) { <br>$(".userid").each(function() { <br>this.checked = true; <br>}) <br>} else { <br>$(".userid" ") .each(function() { <br>this.checked = false; <br>}); <br>} <br>}); <br>//全選<br>$("#checkAll" ). click(function() { <br>$(".userid").each(function() { <br>this.checked = true; <br>}); <br>}); / 取消全部<br> $("#removeAll").click(function() { <br>$(".userid").each(function() { <br>this.checked = false; <br>} ); <br>} ); <br>// 反選<br>$("#reverse").click(function() { <br>$(".userid").each(function() { <br>if (this.checked == true) { <br>this.checked = false <br>} else { <br>this.checked = true; <br>} <br>}) <br>}); <br>//批次刪除<br>$("#delAll").click(function() { <br>var arrUserid = new Array(); <br>$(".userid").each(function( i) { <br>if (this.checked == true) { <br>arrUserid[i] = $(this).val(); <br>} <br>});刪除的:" arrUserid); <br>}); <br>}); <br>腳本> <br>頭> <br><br> <br> <br><tr> <br><td><input type="checkbox" id="checkAllChange"></td> <br><td>用戶id</td> <br><td>用戶名</td> <br><td>電話</td> <br><td>位址</td> <br> </tr> <br><tr> <br><td><input type="checkbox" class="userid" value="1 "></td> <br><td>1</td> <br><td>wangzs1</td> <br><td>18888000</td> <br><td>浦東</td> <br> </tr> <br><tr> <br><td><input type="checkbox" class="userid" value="2"></td> <br><td>2 </td> <br><td>wangzs2</td> <br><td>18888001</td> <br><td>上海</td> <br> </tr> <br><tr> <br><td><input type="checkbox" class="userid" value="3"></td> <br><td>3</td> <br><td>wangzs3</td> <br><td>18888002</td> <br><td>河南</td> <br> </tr> <br><tr> <br><td><input type="checkbox" class="userid" value="4"></td> <br><td>4</td> <br><td>wangzs4</td> <br><td>18888003</td> <br><td>許昌</td> <br> </tr> <br><tr> <br><td></td> <br><td><input type="button" id="checkAll" value="全選"></td> <br><td><input type="button" id="removeAll" value="取消全部"></td> <br><td><input type="button" id="reverse" value="反選"></td> <br> </tr> <br><tr> <br><td colspan="4" align="center"> <input type="button" value="批次刪除" id="delAll"> </td> <br> </tr> <br>表> <br>身體> <br><br> <br><br> </div>