<div class="codetitle"> <span><a style="CURSOR: pointer" data="41192" class="copybut" id="copybut41192" onclick="doCopy('code41192')"><u>复aze代码</u></a></span> 代码如下:</div> <div class="codebody" id="code41192"> <br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 전환기//EN"> <br><HTML> <br> <HEAD> <br> <TITLE> 새 문서.nbsp;</TITLE> <br> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <br> <SCRIPT LANGUAGE="javascript" src="http://www.cnjquery.com/demo/jquery.js"></script> <br> <SCRIPT LANGUAGE="javascript"> <br> <!-- <BR> $("document.quot;).ready(function(){ <br><br> $("#btn1").click(function(){ <br><br> $("[name='checkbox']").attr("checked",'true');//전체选 <br><br> }) <BR> $("#btn2").click (function(){ <br><br> $("[name='checkbox']").removeAttr("checked");//取消전체选 <br><br> }) <BR> $(" #btn3").click(function(){ <br><br> $("[name='checkbox']:even").attr("checked",'true');//选中所有奇数 <br><br> }) <BR> $("#btn4").click(function(){ <br><br> $("[name='checkbox']").each(function(){ <br><br> <BR> if($(this).attr("checked")) <BR> { <BR> $(this).removeAttr("checked"); <br><br> } <BR> else <BR> { <BR> $(this).attr("checked",'true'); <br><br> } <br><br> }) <br><br> }) <BR> $("#btn5").click(function(){ <BR> var str=""; <BR> $("[name='checkbox'][checked]").each(function(){ <BR> str =$(this).val() ""r"n"; <BR> //alert($(this).val()); <BR> }) <BR> 경고(str); > }) <BR> }) <BR> //--> <br> </SCRIPT> <br><br> </HEAD> <br><br> <BODY> <br> <form name="form1" method="post" action=""> <br> <input type="button" id="btn1" value="전체选"> <br> <input type="button" id="btn2" value="取消全选"> <br> <input type="button" id="btn3" value="选中所有奇数"> <br> <input type="button" id="btn4" value="反选"> <br> <input type="button" id="btn5" value="获得选中的所有值"> <br> <br> <br> <input type="checkbox" name="checkbox" value="checkbox1"> <br> checkbox1 <br> <input type="checkbox" name="checkbox" value="checkbox2"> <br> checkbox2 <br> <input type="checkbox" name="checkbox" value="checkbox3"> <br> checkbox3 <br> <input type="checkbox" name="checkbox" value="checkbox4"> <br> checkbox4 <br> <input type="checkbox" name="checkbox" value="checkbox5"> <br> checkbox5 <br> <input type="checkbox" name="checkbox" value="checkbox6"> <br> checkbox6 <br> <input type="checkbox" name="checkbox" value="checkbox7"> <br> checkbox7 <br> <input type="checkbox" name="checkbox" value="checkbox8"> <br> 체크박스8 <br> </form> <br><br> </div>