javascript checkboxの全選と全部選択しません.
1413 ワード
<html>
<head>
<title></title>
<script type="text/javascript">
function checkAll(){
for (var i = 0; i < document.getElementsByName("checkItem").length; i++) {
document.getElementsByName("checkItem")[i].checked = document.getElementById("all").checked;
}
}
</script>
</head>
<body>
<form>
<table >
<tr>
<td><input type="checkbox" name="all" id="all" onclick="checkAll()"/>Select All</td>
</tr>
<tr>
<td><input type="checkbox" name="checkItem" value="value1"/></td>
</tr>
<tr>
<td><input type="checkbox" name="checkItem" value="value2"/></td>
</tr>
<tr>
<td><input type="checkbox" name="checkItem" value="value3"/></td>
</tr>
<tr>
<td><input type="checkbox" name="checkItem" value="value4"/></td>
</tr>
<table >
</form>
</body>
</html>