<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><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml"> <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> <br>$(document).ready(function(){ <br>$("#selectAll").click(function(){ <br>//这里也可直接使用可能,原生js语句 <br>if ($(this)[0].checked){ <br>$('[name=items]:checkbox').attr("checked",true); <br>}else{ <br>$('[ name=items]:checkbox').attr("チェック済み",false); <br>$("#XOR").click(function(){ <br>$( "[name=items]:checkbox").each(function(){ <br>this.checked=!this.checked; <br>}); <br></script> <br><title>無題のドキュメント</title> <br></head> <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></body> <br></html> <br><br> </div>