<div class="codetitle"> <span><a style="CURSOR: pointer" data="53855" class="copybut" id="copybut53855" onclick="doCopy('code53855')"><u>复制代码</u></a></span>如下代码:</div> <div class="codebody" id="code53855"> <br><span style="FONT-SIZE: 14px" html> <br><html> <br><头> <br><title>包装处理.html</title> <br><meta http-equiv="keywords" content="keyword1,keyword2,keyword3">; <br><meta http-equiv="description" content="这是我的页面"> <br><meta http-equiv="content-type" content="text/html; charset=UTF-8"> <br><!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <br></头> <br><身体> <br><input type="checkbox" id="checkItem">全选/全不选<br><br> <br><h3>爱好</h3> <br><input type="checkbox" name="item">看书<br><br> <br><input type="checkbox" name="item">听音乐<br><br> <br><input type="checkbox" name="item">打球 <br><br> <br><input type="checkbox" name="item">散步<br><br> <br><input type="checkbox" name="item">写入代码<br><br> <br><脚本> <br>window.onload = function(){ <br>var checkItem = document.getElementById("checkItem").onclick = function(){ <br>var itemsElement = document.getElementsByName("item"); <br>for (var i = 0; i var itemElement = itemsElement[i]; <br>if (this.checked) { <br>itemElement.checked = "checked"; <br>} <br>else { <br>itemElement.checked = null; <br>} <br>} <br>} <br>} <br>; <br></身体> <br></html> <br></SPAN> <br></span> </div>