<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>函數 <BR>函數(){ <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></腳本> <BR><輸入類型=複選框名稱=chkBox值=1停用> <BR><輸入類型=複選框名稱=chkBox值=1>> <BR><輸入類型=複選框名稱=chkBox值=1>> <BR><輸入類型=複選框名稱=chkBox值=1>> <BR><input type=button value="測試" onclick="func()"> </script> </div> <br> <br>用javascript吧。 <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><br><br> <br> <br> <br>function kk(){ <br>var handleEl = document.getElementById("kkHandler"); <br>var els = document.getElementsByName("kk"); <br>for(i=0; i<els.length>els[i].checked = handleEl.checked; <br>} <br><br>} <br> <br>全選<br> <br> </els.length> </div> <br>身體> <br> <div class="codetitle"><span> <a style="CURSOR: pointer" data="31708" class="copybut" id="copybut31708" onclick="doCopy('code31708')">2: <u></u></a></span></div>複製代碼<div class="codebody" id="code31708"> <br><br>代碼如下:<br><br> <br>< ;表單名稱=“表單”ID=“表單1”> <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>; <br> <br>function selectAll() <br>{ <br>if(!document.form.id.length ){ <br>if(document.form.chose.checked){ <br>document.form.id.checked =真; <br>} <br>else{ <br>document.form.id.checked=falsese ; <br>} <br>} <br>else{ <br>for(var i=0;i<document.form.id.length>if(document.form.chose.checked) { <br>document.form.id[i].checked=true; <br>} <br>else{ <br>document.form.id[i].checked=false; <br>} <br>} </document.form.id.length> </div>} <br>} <br>; <div class="codetitle"><span> <a style="CURSOR: pointer" data="71229" class="copybut" id="copybut71229" onclick="doCopy('code71229')">3:<u></u></a></span></div>複製代碼<div class="codebody" id="code71229"> <br> <br>代碼如下:<br><br> <br>< ;輸入型別='複選框'名稱='訊息'值='a'> <br> <br> <br> <br><br>; <br> <br> <br>function check_all(){ <br>arr = document.getElementsByName('info'); <br>for(i=0;i<arr.length i>arr[i].checked = true; </arr.length> </div>} } 腳本>