<div class="codetitle"> <span><a style="CURSOR: pointer" data="89516" class="copybut" id="copybut89516" onclick="doCopy('code89516')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code89516"> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <br><script language="javascript" src="../css02/js/jquery-1.6.1.js"></script> <br><script> <BR>$(document).ready(function(){ <BR>$("#selectAll").click(function(){ <BR>//这里也可以直接用this,原生js语句 <BR>if($(this)[0].checked){ <BR>$('[name=items]:checkbox').attr("checked",true); <BR>}else{ <BR>$('[name=items]:checkbox').attr("checked",false); <BR>} <BR>}); <BR>$("#XOR").click(function(){ <BR>$("[name=items]:checkbox").each(function(){ <BR>this.checked=!this.checked; <BR>}); <BR>}); <BR>}); <BR></script> <br><title>Untitled Document</title> <br> <br> <br><input type="checkbox" name="items" value="足球">足球 <br><input type="checkbox" name="items" value="足球">足球 <br><input type="checkbox" name="items" value="足球">足球 <br><input type="checkbox" name="items" value="足球">足球 <br><input type="checkbox" id="selectAll" value="全选/不选">全选/全部选 <br><input type="button" id="XOR" value="反选"> <br> <br> <br> </div>