라디오버튼을 이용한 div 보이기 > 기술자료 | 해피정닷컴

라디오버튼을 이용한 div 보이기 > 기술자료

본문 바로가기

사이트 내 전체검색

라디오버튼을 이용한 div 보이기 > 기술자료

JavaScript 라디오버튼을 이용한 div 보이기

페이지 정보


본문

<script>
function div_show(selectList) {
    var obj1 = document.getElementById("js_pay_type1"); // 현금영수증 (개인소득공제용)
    var obj2 = document.getElementById("js_pay_type2"); // 현금영수증 (지출증빙용)
    var obj3 = document.getElementById("js_pay_type3"); // 세금계산서

    if( selectList == "0" ) { // 현금영수증 (개인소득공제용)
        obj1.style.display = "block";    
        obj2.style.display = "none";
        obj3.style.display = "none";
        //alert(    obj.style.display ) ;
    } else if( selectList == "1" ) { // 현금영수증 (지출증빙용)
        obj1.style.display = "none";    
        obj2.style.display = "block";
        obj3.style.display = "none";
        //alert(    obj.style.display ) ;
    } else if( selectList == "2" ) { // 세금계산서
        obj1.style.display = "none";    
        obj2.style.display = "none";
        obj3.style.display = "block";
        //alert(    obj.style.display ) ;
    } else { // 신청안함
        obj1.style.display = "none";
        obj2.style.display = "none";
        obj3.style.display = "none";
    }
}
</script>
<style>
    .pay_select  {float:left;width:25%;float:left;padding:5px 0; }
</style>

<div class=" ">
    <ul>
        <li class="pay_select">
            <input type="radio" name="pay_type1" id="pay_type_1" onclick="div_show('0');" value="개인소득공제용">
            <label for="pay_type_1"><span></span>현금영수증 (개인소득공제용)</label>
        </li>
        <li class="pay_select">
            <input type="radio" name="pay_type1" id="pay_type_2" onclick="div_show('1');" value="지출증빙용">
            <label for="pay_type_2"><span></span>현금영수증 (지출증빙용)</label>
        </li>
        <li class="pay_select">
            <input type="radio" name="pay_type1" id="pay_type_3" onclick="div_show('2');" value="세금계산서">
            <label for="pay_type_3"><span></span>세금계산서</label>
        </li>
        <li class="pay_select">
            <input type="radio" name="pay_type1" id="pay_type_4" onclick="div_show('3');" value="신청안함">
            <label for="pay_type_4"><span></span>신청안함</label>
        </li>
    </ul>
</div>
    

<div id="js_pay_type1" style="display:none">
    <div style="font-size:1.1em;font-weight: bold; padding:20px 0 10px 0;">현금영수증 (개인소득공제용)</div>
    <div>
        <select name="">
            <option value="">휴대폰번호</option>
        </select>
        <select name="">
            <option value="010">010</option>
            <option value="011">011</option>
            <option value="016">016</option>
            <option value="017">017</option>
            <option value="018">018</option>
            <option value="019">019</option>
        </select> -
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value=""> -
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value="">
    </div>
</div>

<div id="js_pay_type2" style="display:none">
    <div style="font-size:1.1em;font-weight: bold; padding:20px 0 10px 0;">현금영수증 (지출증빙용)</div>
    <div>
        <select name="">
            <option value="">사업자등록번호</option>
        </select>
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value=""> -
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value=""> -
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value="">
    </div>
</div>

<div id="js_pay_type3" style="display:none">
    <div style="font-size:1.1em;font-weight: bold; padding:20px 0 10px 0;">세금계산서</div>
    <div style=" padding-left:20px;">
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value=""> -
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value=""> -
        <input type="text" name="pay_type2" style="width:90px;" id="pay_type2" value="">
    </div>
</div>


참고자료
https://www.gldigital.co.kr/javascript/라디오버튼을-이용한-div-보이기

댓글목록

등록된 댓글이 없습니다.


Total 2,634건 10 페이지
  • RSS
기술자료 목록
2454
MySQL   11734  2021-03-23 17:46 ~ 2021-03-23 18:04  
2453
PHP   8089  2021-03-04 19:10 ~ 2021-06-22 00:03  
2452
PHP   6830  2021-03-03 16:20 ~ 2021-03-03 16:21  
2451
그누보드   4574  2021-02-25 22:28 ~ 2021-03-17 11:33  
2450
그누보드   6048  2021-02-18 10:28 ~ 2021-02-18 14:10  
2449
그누보드   6462  2021-02-08 14:43 ~ 2021-02-08 16:31  
2448
PHP   11384  2021-01-20 12:07 ~ 2021-01-27 13:35  
2447
전자결제   8487  2021-01-01 01:20 ~ 2021-01-13 19:41  
열람
JavaScript   6516  2020-12-24 19:40  
2445
HTML   5087  2020-12-20 11:42  
2444
SNS   8813  2020-12-18 07:58  
2443
그누보드   7525  2020-12-14 18:09 ~ 2023-04-04 11:18  
2442
SNS   6384  2020-12-11 09:37 ~ 2020-12-18 11:55  
2441
Apple   5892  2020-12-10 14:22 ~ 2020-12-17 00:27  
2440
Android   9495  2020-12-10 12:22 ~ 2020-12-17 00:27  
2439
그누보드   6335  2020-12-07 15:15 ~ 2022-12-17 21:15  
2438
SNS   6646  2020-11-30 14:39 ~ 2020-12-12 09:04  
2437
SNS   6016  2020-11-29 16:55 ~ 2020-12-18 19:53  
2436
SNS   10127  2020-11-25 14:04 ~ 2020-12-12 09:05  
2435
Apple   5512  2020-11-24 19:27 ~ 2020-11-24 19:34  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: 서울센터 (08393) 서울시 구로구 디지털로32가길 16 파트너스타워2차 1206-280호
        대전센터 (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 지원1동 205호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 2014-서울구로-0074 [사업자등록확인]  
Copyright 2001~2024 해피정닷컴. All Rights Reserved.