<div class="codetitle"> <span><a style="CURSOR: pointer" data="62020" class="copybut" id="copybut62020" onclick="doCopy('code62020')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code62020"> <br><script> <BR>function func(){ <BR>var options=document.getElementsByName("chkBox"); <BR>for (var i=0;i<options.length;i++){ <BR>if(!options[i].disabled){ <BR>options[i].checked=true; <BR>} <BR>} <BR>} <BR></script> <br><input type="checkbox" name="chkBox" value="1" disabled> <br><input type="checkbox" name="chkBox" value="1"> <br><input type="checkbox" name="chkBox" value="1"> <br><input type="checkbox" name="chkBox" value="1"> <br><input type="button" value="测 试" onclick="func()"> <br> </div> <br>用javascript吧。 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="53734" class="copybut" id="copybut53734" onclick="doCopy('code53734')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code53734"> <br> <br> <br><script> <BR>function kk(){ <BR>var handleEl = document.getElementById("kkHandler"); <BR>var els = document.getElementsByName("kk"); <BR>for(i=0;i<els.length;i++){ <BR>els[i].checked = handleEl.checked; <BR>} <br><br>} <BR></script> <br><input type="checkbox" onclick="kk()" name="kkHandler">全选<br> <br><input type="checkbox" name="kk"> <br><input type="checkbox" name="kk"> <br> <br> <br> </div> <br>2: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="31708" class="copybut" id="copybut31708" onclick="doCopy('code31708')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code31708"> <br><form name="form" id="Form1"> <br><input type="checkbox" name="id" value="" id="Checkbox1">1 <br><input type="checkbox" name="id" value="" id="Checkbox2">2 <br><input type="checkbox" name="chose" value="" onclick="selectAll()" id="Checkbox5">allselect <br> </form> <br><script> <BR>function selectAll() <BR>{ <BR>if(!document.form.id.length){ <BR>if(document.form.chose.checked){ <BR>document.form.id.checked=true; <BR>} <BR>else{ <BR>document.form.id.checked=false; <BR>} <BR>} <BR>else{ <BR>for(var i=0;i<document.form.id.length;i++){ <BR>if(document.form.chose.checked){ <BR>document.form.id[i].checked=true; <BR>} <BR>else{ <BR>document.form.id[i].checked=false; <BR>} <BR>} <BR>} <BR>} <BR></script> <br> </div> <br>3: <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="71229" class="copybut" id="copybut71229" onclick="doCopy('code71229')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code71229"> <br><input type="checkbox" name="info" value="a"> <br><input type="checkbox" name="info" value="b"> <br><input type="checkbox" name="info" value="c"> <br><input type="checkbox" name="info" value="d"> <br><input type="checkbox" name="info" value="e"><br> <br><input type="button" value=" 全选 " onclick="check_all();"> <br><script> <BR>function check_all(){ <BR>arr = document.getElementsByName('info'); <BR>for(i=0;i<arr.length;i++){ <BR>arr[i].checked = true; <BR>} <BR>} <BR></script> <br> </div>