<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<title>CheckBox All Select</title>
<script language="javascript">
function checkAll(){
cBox = cForm.chk;
if(cBox.length) { // 여러 개일 경우
for(var i = 0; i<cBox.length;i++) {
cBox[i].checked = cForm.all.checked;
}
} else { // 한 개일 경우
cBox.checked = cForm.all.checked;
}
}
</script>
</head>
<body>
<form name="cForm" >
<p>All <input type="checkbox" name="all" onclick="checkAll()" />
A <input type="checkbox" name="chk" />
B <input type="checkbox" name="chk" />
C <input type="checkbox" name="chk" />
</p>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<title>CheckBox All Select</title>
<script language="javascript">
function checkAll(){
cBox = cForm.chk;
if(cBox.length) { // 여러 개일 경우
for(var i = 0; i<cBox.length;i++) {
cBox[i].checked = cForm.all.checked;
}
} else { // 한 개일 경우
cBox.checked = cForm.all.checked;
}
}
</script>
</head>
<body>
<form name="cForm" >
<p>All <input type="checkbox" name="all" onclick="checkAll()" />
A <input type="checkbox" name="chk" />
B <input type="checkbox" name="chk" />
C <input type="checkbox" name="chk" />
</p>
</form>
</body>
</html>