체크박스 스크립트 질문

체크박스 스크립트 질문

QA

체크박스 스크립트 질문

본문


<aside id="side_search" class="at-sidebar en<?php echo $sidebar_effect;?>">
    <div class="close-box asideButton1" title="Hide sidebar" style="margin-top:100px;">
        <i class="fa fa-search"></i>
    </div>
    <div class="sidebar-wrap">
    <form name="frmdetailsearch" role="form"  method="get" action="/shop/search.php" onsubmit="return fsearchbox_submit(this);">
    <input type="hidden" name="qsort" id="qsort" value="<?php echo $qsort ?>">
    <input type="hidden" name="qorder" id="qorder" value="<?php echo $qorder ?>">
    <input type="hidden" name="qcaid" id="qcaid" value="<?php echo $qcaid ?>">
        <div>
            <div id="group1">
                <label style="display:block;"><b>고객님꼐서 가장 중요하게 생각하시는 기능은?</b><br></label>
                    <input type="checkbox" id="step1_1" onclick="eventCheck(this,'group1')"> 스크린 프로젝터<br>
                    <input type="checkbox" id="step1_2" onclick="eventCheck(this,'group1')"> 판서(글쓰기)<br>
                    <input type="checkbox" id="step1_3" onclick="eventCheck(this,'group1')"> 지움성<br>
                    <input type="checkbox" id="step1_4" onclick="eventCheck(this,'group1')"> 인테리어 효과
            </div>
            <div id="group2_1" style="display:none;">
                <label style="display:block;"><b>스크린 프로젝터</b><br></label>
                    <input type="checkbox" id="step2_1" name="it_1[]" value="1" onclick="eventCheck(this,'group2_1')" <?php echo in_array("1",$it_1)?'checked="checked"':'';?>> 무반사 화이트보드<br>
                    <input type="checkbox" id="step2_2" name="it_1[]" value="2" onclick="eventCheck(this,'group2_1')" <?php echo in_array("2",$it_1)?'checked="checked"':'';?>> 무반사 화이트보드 시트지<br>
                    <input type="checkbox" id="step2_3" name="it_1[]" value="3" onclick="eventCheck(this,'group2_1')" <?php echo in_array("3",$it_1)?'checked="checked"':'';?>> 스크린 유리보드<br>
                    <input type="checkbox" id="step2_4" name="it_1[]" value="4" onclick="eventCheck(this,'group2_1')" <?php echo in_array("4",$it_1)?'checked="checked"':'';?>> 그랜드뷰 리마커블 스크린
            </div>
            <div id="group2_2" style="display:none;">
                <label style="display:block;"><b>판서(글쓰기)</b><br></label>
                    <input type="checkbox" id="step2_5" name="it_1[]" value="1" onclick="eventCheck(this,'group2_2')" <?php echo in_array("1",$it_1)?'checked="checked"':'';?>> 두배로 화이트보드<br>
                    <input type="checkbox" id="step2_6" name="it_1[]" value="2" onclick="eventCheck(this,'group2_2')" <?php echo in_array("2",$it_1)?'checked="checked"':'';?>> 두배로 화이트보드 시트지<br>
                    <input type="checkbox" id="step2_7" name="it_1[]" value="3" onclick="eventCheck(this,'group2_2')" <?php echo in_array("3",$it_1)?'checked="checked"':'';?>> 난반사 유리보드<br>
                    <input type="checkbox" id="step2_8" name="it_1[]" value="4" onclick="eventCheck(this,'group2_2')" <?php echo in_array("4",$it_1)?'checked="checked"':'';?>> 유광 유리보드<br>
                    <input type="checkbox" id="step2_9" name="it_1[]" value="3" onclick="eventCheck(this,'group2_2')" <?php echo in_array("3",$it_1)?'checked="checked"':'';?>> 법랑화이트보드<br>
                    <input type="checkbox" id="step2_10" name="it_1[]" value="3" onclick="eventCheck(this,'group2_2')" <?php echo in_array("3",$it_1)?'checked="checked"':'';?>> 물칠판<br>
                    <input type="checkbox" id="step2_11" name="it_1[]" value="3" onclick="eventCheck(this,'group2_2')" <?php echo in_array("3",$it_1)?'checked="checked"':'';?>> 청칠판
            </div>
            <div id="group2_3" style="display:none;">
                <label style="display:block;"><b>지움성</b><br></label>
                    <input type="checkbox" id="step2_5" name="it_1[]" value="1" onclick="eventCheck(this,'group2_3')" <?php echo in_array("1",$it_1)?'checked="checked"':'';?>> 두배로 화이트보드<br>
                    <input type="checkbox" id="step2_6" name="it_1[]" value="2" onclick="eventCheck(this,'group2_3')" <?php echo in_array("2",$it_1)?'checked="checked"':'';?>> 두배로 화이트보드 시트지<br>
                    <input type="checkbox" id="step2_7" name="it_1[]" value="3" onclick="eventCheck(this,'group2_3')" <?php echo in_array("3",$it_1)?'checked="checked"':'';?>> 난반사 유리보드<br>
                    <input type="checkbox" id="step2_8" name="it_1[]" value="4" onclick="eventCheck(this,'group2_3')" <?php echo in_array("4",$it_1)?'checked="checked"':'';?>> 유광 유리보드
            </div>
            <div id="group2_4" style="display:none;">
                <label style="display:block;"><b>인테리어 효과</b><br></label>
                    <input type="checkbox" id="step2_1" name="it_1[]" value="1" onclick="eventCheck(this,'group2_4')" <?php echo in_array("1",$it_1)?'checked="checked"':'';?>> 무반사 화이트보드<br>
                    <input type="checkbox" id="step2_2" name="it_1[]" value="2" onclick="eventCheck(this,'group2_4')" <?php echo in_array("2",$it_1)?'checked="checked"':'';?>> 무반사 화이트보드 시트지<br>
                    <input type="checkbox" id="step2_7" name="it_1[]" value="3" onclick="eventCheck(this,'group2_4')" <?php echo in_array("3",$it_1)?'checked="checked"':'';?>> 난반사 유리보드<br>
                    <input type="checkbox" id="step2_4" name="it_1[]" value="4" onclick="eventCheck(this,'group2_4')" <?php echo in_array("4",$it_1)?'checked="checked"':'';?>> 그랜드뷰 리마커블 스크린
            </div>
            <div id="group3_1" style="display:none;">
                <div>
                    <label style="display:block;"><b>선택 옵션</b><br></label>
                        <input type="checkbox" name="it_2" value="yes" <?php echo $it_2_check?'checked="checked"':'';?>> 자석 기능<br>
                        <input type="checkbox" name="it_3" value="yes" <?php echo $it_3_check?'checked="checked"':'';?>> 이동식 스탠드<br>
                        <input type="checkbox" name="it_4" value="yes" <?php echo $it_4_check?'checked="checked"':'';?>> 맞춤시공
                </div>
                <div>
                    <label style="display:block;"><b>프레임 스타일</b><br></label>
                        <input type="checkbox" name="it_5" value="" <?=$_GET['it_5']==''?' checked="checked"':''?>> 전체<br>
                        <input type="checkbox" name="it_5[]" value="1" <?php echo in_array("1",$it_5)?'checked="checked"':'';?>> 알루미늄(은색)<br>
                        <input type="checkbox" name="it_5[]" value="2" <?php echo in_array("2",$it_5)?'checked="checked"':'';?>> 오크목<br>
                        <input type="checkbox" name="it_5[]" value="3" <?php echo in_array("3",$it_5)?'checked="checked"':'';?>> 월넛목<br>
                        <input type="checkbox" name="it_5[]" value="4" <?php echo in_array("4",$it_5)?'checked="checked"':'';?>> 화이트목<br>
                        <input type="checkbox" name="it_5[]" value="5" <?php echo in_array("5",$it_5)?'checked="checked"':'';?>> 블랙목
                </div>
                <div class="nop">
                    <label><b>가로 선택 (cm)</b></label>
                    <div>
                        <label>
                            <input type="text" name="wfrom" value="<?php echo $wfrom; ?>" id="ssch_wfrom" size="10" placeholder="최소 가로">
                        </label>
                        <label> ~</label>
                        <label>
                            <input type="text" name="wto" value="<?php echo $wto; ?>" id="ssch_wto" size="10" placeholder="최대 가로">
                        </label>
                    </div>
                </div>
                <div class="nop">
                    <label><b>세로 선택 (cm)</b></label>
                    <div>
                        <label>
                            <input type="text" name="hfrom" value="<?php echo $hfrom; ?>" id="ssch_hfrom" size="10" placeholder="최소 세로">
                        </label>
                        <label> ~</label>
                        <label>
                            <input type="text" name="hto" value="<?php echo $hto; ?>" id="ssch_hto" size="10" placeholder="최대 세로">
                        </label>
                    </div>
                </div>
                <div class="nop">
                    <label><b>상품가격 (원)</b></label>
                    <div>
                        <label>
                            <input type="text" name="qfrom" value="<?php echo $qfrom; ?>" id="ssch_qfrom" size="10" placeholder="최소 가격">
                        </label>
                        <label> ~</label>
                        <label>
                            <input type="text" name="qto" value="<?php echo $qto; ?>" id="ssch_qto" size="10" placeholder="최대 가격">
                        </label>
                    </div>
                </div>
                <div class="si">
                    <div>
                        <button type="submit">검색하기</button>
                    </div>
                </div>
            </div>
            <div id="group3_2" style="display:none;">
                <div>
                    <label style="display:block;"><b>선택 옵션</b><br></label>
                        <input type="checkbox" name="it_4" value="yes" <?php echo $it_4_check?'checked="checked"':'';?>> 맞춤시공
                </div>
                <div class="nop">
                    <label><b>가로 선택 (cm)</b></label>
                    <div>
                        <label>
                            <input type="text" name="wfrom" value="<?php echo $wfrom; ?>" id="ssch_wfrom" size="10" placeholder="최소 가로">
                        </label>
                        <label> ~</label>
                        <label>
                            <input type="text" name="wto" value="<?php echo $wto; ?>" id="ssch_wto" size="10" placeholder="최대 가로">
                        </label>
                    </div>
                </div>
                <div class="nop">
                    <label><b>세로 선택 (cm)</b></label>
                    <div>
                        <label>
                            <input type="text" name="hfrom" value="<?php echo $hfrom; ?>" id="ssch_hfrom" size="10" placeholder="최소 세로">
                        </label>
                        <label> ~</label>
                        <label>
                            <input type="text" name="hto" value="<?php echo $hto; ?>" id="ssch_hto" size="10" placeholder="최대 세로">
                        </label>
                    </div>
                </div>
                <div class="nop">
                    <label><b>상품가격 (원)</b></label>
                    <div>
                        <label>
                            <input type="text" name="qfrom" value="<?php echo $qfrom; ?>" id="ssch_qfrom" size="10" placeholder="최소 가격">
                        </label>
                        <label> ~</label>
                        <label>
                            <input type="text" name="qto" value="<?php echo $qto; ?>" id="ssch_qto" size="10" placeholder="최대 가격">
                        </label>
                    </div>
                </div>
                <div class="si">
                    <div>
                        <button type="submit">검색하기</button>
                    </div>
                </div>
            </div>
            <div id="group3_3" style="display:none;">
                <div>
                    <label style="display:block;"><b>선택 옵션</b><br></label>
                        <input type="checkbox" name="it_4" value="yes" <?php echo $it_4_check?'checked="checked"':'';?>> 맞춤시공
                </div>
                <div class="si">
                    <div>
                        <button type="submit">검색하기</button>
                    </div>
                </div>
            </div>
        </div>
    </form>
    </div>
    <script>
        function set_sort(qsort) {
            var f = document.frmdetailsearch;
            var qorder = "desc";
            if(qsort == "it_price_min") {
                qsort = "it_price";
                qorder = "asc";
            }
            f.qsort.value = qsort;
            f.qorder.value = qorder;
            f.submit();
        }
        function set_ca_id(qcaid) {
            var f = document.frmdetailsearch;
            f.qcaid.value = qcaid;
            f.submit();
        }
    </script>
    <script language="javascript">
        $(function(){
            $("div#group1").find("input[type='checkbox']").click(function(){
                idx = $("div#group1").find("input[type='checkbox']").index(this);
         
                $("div#group1").find("input[type='checkbox']").each(function(i){
                    if(idx == i && $(this).is(":checked")){
                        $("#group2_" + parseInt(i+1)).show();
                    }else{
                        $(this).attr("checked", false);
                        $("#group2_" + parseInt(i+1)).hide();
                    }
                })
            });
        });
       
    </script>
</aside> 

 

이렇게 해서 1단계 체크하면 2단계는 나왔는데요 3단계(group3)까지 나와야해요 ㅠㅠ

 

2단계의 각각 step2_1~11까지 여러 체크 종류가 있는데

 

2_4는 group3_3이 나와야 하고 2_2,2_6은 group3_2가, 나머지는 group_3_1이 나와야해요

 

어떻게 하면 될까요? ㅠㅠ 

 

이 질문에 댓글 쓰기 :

답변을 작성하시기 전에 로그인 해주세요.
전체 2

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT