<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><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>// 取消全部 <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>}); <BR>alert("批量删除的:" + arrUserid); <BR>}); <BR>}); <BR></script> <br> <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> <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> </table> <br> <br><br> <br> </div>