<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> <br> <br><script src="jquery-1.3.2.min.js" type="text/javascript"></script> <br> <br> <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> <br> <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>