<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">< ;!DOCTYPE html> <BR><html> <BR><頭> <BR><title>复选框处処理.html</title> <br><meta http-equiv="キーワード" content="キーワード1,キーワード2,キーワード3"> <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></head> <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 < itemsElement.length; i ) { <BR>var itemElement = itemsElement[i]; <BR>if (this.checked) { <BR>itemElement.checked = "チェック済み"; <BR>} <BR>else { <BR>itemElement.checked = null; <BR>} <BR>} <BR>} <BR>} <BR></script> <br></body> <br></html> <br></SPAN> <br> </div>