모두선택 제외되는 체크박스
본문
아래 소스를 보시면
모두선택이 있는데요
현재는 모두선택을 하게 되면 3번체크박스는 제외하고 선택되게 되어 있습니다.
이걸 해제되는 항목없이 모두 선택되게 하고 싶은데요
어딜 수정해야 할까요??
부탁드립니다. ㅜㅜ
<%@ page contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/color/color.jspf"%>
<%@ page import="java.sql.*"%>
<%
Timestamp register = new Timestamp(System.currentTimeMillis());
String strdate = register.toString().substring(0, 10);
String[] strtemps = strdate.split("-");
String date="";
for(int i=0;i<strtemps.length;i++){
date+=strtemps[i];
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href="style.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("input[name='chk_all']").click(function() {
var chk_listArr = $("input[name='select']");
for ( var i = 0; i < chk_listArr.length; i++) {
if(i==2) continue;
chk_listArr[i].checked = this.checked;
}
});
$("input[name='select']").click(function() { //리스트 항목이 모두 선택되면 전체 선택 체크
if ($("input[name='select']:checked").length == 5) {
$("input[name='chk_all']")[0].checked = true;
} else { //리스트 항목 선택 시 전체 선택 체크를 해제함
$("input[name='chk_all']")[0].checked = false;
}
});
});
function only_number(){
if(event.keyCode <=47||(event.keyCode >57 && event.keyCode!=126)){
alert("숫자만 입력가능합니다.");
event.returnValue = false;
}
}
function only_Hangul(){
if(event.keyCode<12592 ||event.KeyCode>12687){
alert("한글만 입력가능합니다.");
event.returnValue=false;
}
}
function only_Text(){
if(event.keyCode <65||(event.keyCode >90 && event.keyCode==126)){
alert("문자만 입력가능합니다.");
event.returnValue = false;
}
}
function checkagree2(){
if ($("input[name='agree2']:checked").length == 1) {
alert("설문 도중에 중단하시면 정신건강센터에서 제공하는 서비스를 받으실 수 없습니다. 처음 화면이 나타날 때까지 설문을 마무리 해 주시기 바랍니다. 모든 검사를 진행했을경우에 10분정도의 시간이 소요됩니다.");
}
}
function checkIt() {
if ($("input[name='agree1']:checked").length == 0) {
alert("동의1");
return false;
}
if ($("input[name='agree2']:checked").length == 0) {
alert("동의2");
return false;
}
if (!document.myform.name.value) {
alert("이름을입력하지않으셨습니다.");
document.myform.name.focus();
return false;
}
if (!document.myform.phone.value) {
alert("연락처를입력하지않으셨습니다.");
document.myform.phone.focus();
return false;
}
if ($("input[name='select']:checked").length == 0) {
alert("설문");
return false;
}
}
</script>
</head>
<body>
<%@ include file="/inc/top2.html"%>
<form name="myform" action="/view/research/researchMainPro.do" method="post" onSubmit="return checkIt()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td width="1000" align="center">
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
<table width="900" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="99" colspan="2" valign="top"><img src="/img/sub/sub_04.jpg" width="602" height="52" /></td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="35" valign="top"><img src="/img/sub/sub_10.jpg" width="362" height="23" /></td>
</tr>
<tr>
<td width="17"> </td>
<td width="883"><img src="/img/sub/sub_13.jpg" width="824" height="217" /></td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="71" valign="top">
<table width="824" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="20">
<input type="checkbox" name="agree1" />
</td>
<td class="txt">본인은 본 평가에 자발적으로 동의합니다.</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="36" valign="top"><img src="/img/sub/sub_16.jpg" width="824" height="23" /></td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="71" valign="top">
<table width="824" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="20">
<input type="checkbox" name="agree2" onclick="checkagree2()" />
</td>
<td class="txt">오산시정신건강복지센터에서 제공하는 결과 안내 및 결과에 따른 서비스 제공에 동의합니다.</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="46" valign="top"><img src="/img/sub/sub_19.jpg" width="824" height="23" /></td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="46" background="/img/sub/sub_22.jpg">
<table width="824" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33"> </td>
<td width="93"><img src="/img/sub/sub_24.jpg" width="93" height="25" /></td>
<td>
<input type="text" name="date" size="30"
style="IME-MODE: disabled;" class="txt"
onkeypress="only_number()" value=<%=date%> maxlength="8">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="45" background="/img/sub/sub_27.jpg">
<table width="824" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33"> </td>
<td width="93"><img src="/img/sub/sub_28.jpg" width="93" height="25" /></td>
<td>
<input type="text" name="name" size="30"
class="txt"
onkeypress="only_Text()">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="47" background="/img/sub/sub_30.jpg">
<table width="824" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="33"> </td>
<td width="93"><img src="/img/sub/sub_31.jpg" width="93" height="25" /></td>
<td>
<input type="text" name="phone" size="30"
style="IME-MODE: disabled;" class="txt"
onkeypress="only_number()" >
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="51"> </td>
</tr>
<tr>
<td width="17"> </td>
<td width="883">
<table width="824" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="229"><img src="/img/sub/sub_34.jpg" width="229" height="23" /></td>
<td>
<table width="524" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="35" height="20" align="center">
<input type="checkbox" id="chk_all" name="chk_all">
</td>
<td class="txt">모두선택</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="23"> </td>
</tr>
<tr>
<td> </td>
<td height="48">
<table bgcolor="#cccccc" width="824" border="0" cellspacing="1" cellpadding="0">
<tr>
<td width="1137" height="48" align="center" bgcolor="#FFFFFF"><img src="/img/sub/sub_42.jpg" width="35" height="20" /></td>
<td width="1137" align="center" bgcolor="#FFFFFF"><img src="/img/sub/sub_44.jpg" width="44" height="20" /></td>
<td width="1137" align="center" bgcolor="#FFFFFF"><img src="/img/sub/sub_48.jpg" width="32" height="20" /></td>
<td width="1137" align="center" bgcolor="#FFFFFF"><img src="/img/sub/sub_50.jpg" width="69" height="20" /></td>
<td width="1137" align="center" bgcolor="#FFFFFF"><img src="/img/sub/sub_52.jpg" width="60" height="20" /></td>
</tr>
<tr>
<td height="85" align="center" bgcolor="#FFFFFF">
<input type="checkbox" name="select" id="test" value="list1" />
</td>
<td align="center" bgcolor="#FFFFFF">
<input type="checkbox" name="select" id="test" value="list2" />
</td>
<td align="center" bgcolor="#FFFFFF">
<input type="checkbox" name="select" id="test" value="list4" /></form>
</td>
<td align="center" bgcolor="#FFFFFF">
<input type="checkbox" name="select" id="test" value="list5" /></form>
</td>
<td align="center" bgcolor="#FFFFFF">
<input type="checkbox" name="select" id="test" value="list6" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td height="22"> </td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" align="center"><input type="image" src="/img/sub/sub_63.jpg" width="188" height="46" /></td>
</tr>
<tr>
<td width="17"> </td>
<td width="883" height="78"> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td> </td>
</tr>
</table>
</form>
<%@ include file="/inc/bottom.html"%>
</body>
</html>