<div class="codetitle"> <span><a style="CURSOR: pointer" data="44677" class="copybut" id="copybut44677" onclick="doCopy('code44677')"><u>复制代码</u></a></span>代码如下:</div> <div class="codebody" id="code44677"> <br><html> <br> <br><title>制作全选效果</title> <br><スクリプト言語="javascript"> <br>function selectAll(){ <br>allcheckBoxs=document.getElementsByName("a"); <br>var a2=document.getElementsByName("a1"); <br>if(a2[0].checked){ <br>for(var i=0;i<allcheckBoxs.length;i ){ <BR>allcheckBoxs[i].checked = true; <BR>} <BR>}else{ <BR>for(var i=0;i<allcheckBoxs.length;i ){ <BR>allcheckBoxs[i].checked = false; <BR>} <BR>} <BR>} <BR></script> <br></head> <br> <br><フォーム名="myform"> <br> <br><tr><tdcolspan="2"><img src="images/head.jpg"/></td></tr> <br><tr> <br><td><input type="checkbox" name="a1" onclick="selectAll()" />全选/全不选</td> <br><td> <img src="images/top.jpg"/></td> <br></tr> <br><tr><td><input type="checkbox" name="a" /></td><td><img src="images/one.jpg"/> ;</td></tr> <br><tr><td><input type="checkbox" name="a" /></td><td><img src="images/two.jpg"/> ;</td></tr> <br><tr><td><input type="checkbox" name="a" /></td><td><img src="images/three.jpg"/> ;</td></tr> <br><tr><td><input type="checkbox" name="a" /></td><td><img src="images/four.jpg"/> ;</td></tr> <br></table> <br></form> <br></body> <br></html> <br> </td> </tr> </div>