t

체크박스 3개이상 선택시 해당 박스 보이기 질문드립니다.

· 2011-07-04 (월) 15:06:09 · 1031 · 1
아래에서 체크박스 3개이상 선택되면 아래 박스보이기 질문 드립니다.
여기저기 검색을 해봐도 선택시 결과는 있는데 체크된 수량에 따라 나오는 결과에 대한것은 찾기가 어렵네요.

<p><input type="checkbox" name="a1">1항목 <input type="checkbox" name="a2">2항목 <input type="checkbox" name="a3">3항목 <input type="checkbox" name="a4">4항목 <input type="checkbox" name="a5">5항목</p>
<p> </p>
<table border="1" width="329" height="70">
<tr>
<td width="319">3개이하는 이박스</td>
</tr>
</table>

<table border="1" width="329" height="70">
<tr>
<td width="319">3개이상은 이박스</td>
</tr>
</table>
|

댓글 1개

다른곳에서 답을 얻었습니다.
혹시 필요하실 분이 있으실지 몰라 올립니다.

---------------------------------------------------------------------------------
<script type='text/javascript'>
function Chk(cname) {
var cnt=0;
for( var iStep=0; iStep < document.forms(0).elements.length; iStep++){
var elem = form1.elements[iStep];
if(elem.checked == true) cnt++;
}

if(cnt >= 3) {
document.getElementById('box1').style.display = "none";
document.getElementById('box2').style.display = "block";
} else {
document.getElementById('box2').style.display = "none";
document.getElementById('box1').style.display = "block";
}
}
</script>

<form name='form1'>
<p>
<input type="checkbox" name="a" onClick="Chk('a');">1항목
<input type="checkbox" name="a" onClick="Chk('a');">2항목
<input type="checkbox" name="a" onClick="Chk('a');">3항목
<input type="checkbox" name="a" onClick="Chk('a');">4항목
<input type="checkbox" name="a" onClick="Chk('a');">5항목
</p>
<p> </p>
<div id='box1' style="display:none;">
<table border="1" width="329" height="70">
<tr>
<td width="319">3개이하는 이박스</td>
</tr>
</table>
</div>
<div id='box2' style="display:none;">
<table border="1" width="329" height="70">
<tr>
<td width="319">3개이상은 이박스</td>
</tr>
</table>
</div>
</form>
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
11-07-05 조회 1,599
11-07-05 조회 815
11-07-04 조회 872
11-07-04 조회 841
11-07-04 조회 1,975
11-07-04 조회 1,552
11-07-04 조회 1,092
11-07-04 조회 935
11-07-04 조회 1,135
11-07-04 조회 1,411
11-07-04 조회 1,146
11-07-04 조회 1,037
11-07-04 조회 1,604
11-07-04 조회 2,013
11-07-04 조회 1,893
11-07-04 조회 1,065
11-07-04 조회 1,032
11-07-04 조회 860
11-07-04 조회 1,079
11-07-04 조회 853