<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><!DOCTYPE html> <br> <br> <br><script type="text/javascript" src="../js/jquery-1.9.1.js"></script> <br><script type="text/javascript"> <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>$("#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></script> <br></head> <br><br> <br><table border="1"> <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> <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> <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> <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> <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> <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> <tr> <br><tdcolspan="4" align="center"><input type="button" value="批量删除" id="delAll"></td> <br></tr> <br></table> <br></body> <br><br></html> <br><br> </tr> </div>