<head>
<title>연습</title>
<script type="text/javascript">
function check()
{
var allbox = document.getElementById('allbox');
var chkbox = document.getElementsByName('chkbox');
for(var i = 0; i < chkbox.length; i++)
{
if(allbox.checked == true)
{
chkbox[i].checked = true;
txtChk.innerHTML = '전체해제ㅋ<br />';
}
else
{
chkbox[i].checked = false;
txtChk.innerHTML = '전체선택ㅋ<br />';
}
}
}
</script>
</head>
<body>
<form name="form1" id="form1" method="post" action="test2.asp" >
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<input type="checkbox" id="allbox" name="allcheck" value="1" onclick="check();" /><span id="txtChk">전체선택ㅋ</span>
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="chkbox" value="2" /><br />
<input type="checkbox" name="chkbox" value="3" /><br />
<input type="checkbox" name="chkbox" value="4" /><br />
<input type="checkbox" name="chkbox" value="5" /><br />
<input type="checkbox" name="chkbox" value="6" /><br />
<input type="checkbox" name="chkbox" value="7" /><br />
<input type="checkbox" name="chkbox" value="8" /><br />
<input type="checkbox" name="chkbox" value="9" /><br />
</td>
</tr>
</table>