<div class="codetitle"> <span><a style="CURSOR: pointer" data="40203" class="copybut" id="copybut40203" onclick="doCopy('code40203')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code40203"> <br><html> <br><head> <br><script src="jquery-1.3.2.min.js" type="text/javascript"></script> <br></head> <br><body> <br><input type="checkbox" name="chk_list" id="chk_list_1" value="1" />1<br /> <br><input type="checkbox" name="chk_list" id="chk_list_2" value="2" />2<br /> <br><input type="checkbox" name="chk_list" id="chk_list_3" value="3" />3<br /> <br><input type="checkbox" name="chk_list" id="chk_list_4" value="4" />4<br /> <br><input type="checkbox" name="chk_all" id="chk_all" />全选/取消全选 <br><script type="text/javascript"> <br>$("#chk_all").click(function(){ <br>$("input[name='chk_list']").attr("checked",$(this).attr("checked")); <br>}); <br></script> <br></body> <br></html> <br> </div> <br><br>下面的代码是获取上面实例中选中的checkbox的value值: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="31917" class="copybut" id="copybut31917" onclick="doCopy('code31917')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code31917"> <br><script type="text/javascript"> <br>var arrChk=$("input[name='chk_list'][checked]"); <br>$(arrChk).each(function(){ <br>window.alert(this.value); <br>}); <br>}); <br></script> <br> </div>