폼요서 숨김/보임

by hlee0126

HTML

<form name="unitFrm" method="post" style="float: left;">
    <table class="basketTbl3">
        <caption>실시간계좌이체 결제 정보를 나타내는 표</caption>
        <colgroup>
            <col width="25%">
                <col>
        </colgroup>
        <thead>
            <tr>
                <th colspan="2" align="left">실시간 계좌이체</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <th scope="row">현금영수증 발행</th>
                <td>
                    <fieldset>
                        <legend>현금영수증 발행에 필요한 정보 입력 폼</legend>
                        <input type="radio" id="tax_gb1" name="reduce_tax_gb" value="1">
                        <label for="tax_gb1">소득공제용(일반개인용)</label>
                        <input type="radio" id="tax_gb2" name="reduce_tax_gb" value="2">
                        <label for="tax_gb2">지출증빙용(사업자)</label>
                        <input type="radio" id="tax_gb0" name="reduce_tax_gb" value="0" checked="checked">
                        <label for="tax_gb0">발행안함</label>
                        <div class="blockBox" id="div_reduce_tax" style="display:none">
                            <select title="현금영수증 발행 선택" class="marginR" id="slct_reduce_tax">
                                <option value="1" selected="selected">휴대폰 번호</option>
                                <option value="0">주민등록번호</option>
                            </select>	<span id="input_reduce_tax_resd" style="display:none">
								<input title="주민번호 앞자리" type="text" class="input_textL userInputNumber" name="online_tax_resident_no1" id="online_tax_resident_no1" maxlength="6"  size="6" > -
								<input title="주민번호 뒷자리" type="password" class="input_textL" name="online_tax_resident_no2" id="online_tax_resident_no2" maxlength="7"  size="7">
						
								<p class="txtList desc_tax_agree">조세특례 제한법 제 126조의 3에 의거 현금영수증 처리를 위한 고객님의 주민번호를 수집합니다.<br>
									수집된 주민번호는 현금영수증 처리를 위해 수집하며 그 외의 용도로는 사용하지 않습니다.<br>
									<span class="txt_tax_agree">이에 동의하십니까?</span> 
  ...

CSS

table.basketTbl2 {
    width:100%;
}
table.basketTbl2 th, table.basketTbl2 td {
    padding:10px;
    border: 1px solid #eaeaea;
}
table.basketTbl2 th {
    height:30px;
    background:#f6f6f6;
    color: #333;
}
table.basketTbl2.selPay th {
    text-align:left;
}
table.basketTbl2.selPay th a {
    display: block;
    background: #eaf6fc;
    border: 1px solid #6aa7a9;
    padding: 4px 2px;
    text-align: center;
}
table.basketTbl2.selPay td.line1 {
    line-height: 18px;
}
table.basketTbl3 {
    font-size:12px;
}
table.basketTbl3 {
    width:550px;
    float: left;
}
table.basketTbl3 th, table.basketTbl3 td {
    padding:10px;
    border: 1px solid #eaeaea;
}
table.basketTbl3 th {
    background:#f6f6f6;
    color: #333;
    text-align: left;
}
.payBlock {
    float:right;
    width:210px
}
table.payBox {
    width: 100%;
    border: 1px solid #eaeaea;
}
table.payBox tbody {
    border-top: solid 1px;
    border-bottom:solid 1px;
}
table.payBox th, .rightTotalBox td {
    padding:13px 10px;
}
table.payBox th {
    text-align: left;
}
table.payBox td {
    text-align:center;
}
table.payBox td b {
    color:red;
}
ul.info {
    list-style-type: disc;
    padding: 10px;
    background: #f4f4f4;
    margin-top:10px;
}
ul.info li {
    margin-left: 20px;
}

JavaScript

// 현금영수증 발행구분 선택
$("[name$=reduce_tax_gb]").bind("click", function () {
    $("#disp_tax_text_biz").css("display", "none");
    $("#div_reduce_tax").css("display", "none");
    $("#div_biz_reduce_tax").css("display", "none");

    if ($(this).val() == "1") {
        $("#div_reduce_tax").css("display", "");
    } else if ($(this).val() == "2") {
        $("#div_biz_reduce_tax").css("display", "");
        $("#disp_tax_text_biz").css("display", "");
    }
});

// 현금영수증-소득공제용
$("#slct_reduce_tax").bind("change", function () {
    if ($(this).val() == "1") { // 핸드폰
        if (fnIsIpinCust()) {
            alert("주민등록번호만 선택이 가능합니다.");
            $("#input_reduce_tax_resd").show();
            $("#input_reduce_tax_hp").hide();
        } else {
            $("#input_reduce_tax_resd").hide();
            $("#input_reduce_tax_hp").show();
        }
    } else { // 주민번호
        $("#input_reduce_tax_resd").show();
        $("#input_reduce_tax_hp").hide();
    }
});

// 현금영수증 - 지출증빙용
$("#slct_biz_reduce_tax").bind("change", function () {
    if ($(this).val() == "1") { // 사업자 번호
        if (fnIsIpinCust()) {
            alert("주민등록번호만 선택이 가능합니다.");
            $("#input_biz_reduce_tax_resd").show();
            $("#input_biz_reduce_tax_bizno").hide();
        } else {
            $("#input_biz_reduce_tax_bizno").show();
            $("#input_biz_reduce_tax_bizno input").eq(0).focus();
            $("#input_biz_reduce_tax_resd").hide();
        }

    } else { // 주민등록번호
        $("#input_biz_reduce_tax_resd").show();
        $("#input_biz_reduce_tax_bizno").hide();
    }
});

// 동의여부 체크
$("#cert_agree").bind("click", function () {
    if ($(this).is(":checked")) {
        $(".agreeMsg").css("display", "none");
    }
});

fnIsIpinCust = function () {
    var reduce_tax_gb = "";
    $("input[name=reduce_tax_gb]", $("#ordFrm")).each(function () {
        if ($(this).is(":checked")) {
            reduce_tax_gb = $(this).val();
        }
    });

    if ((reduce_tax_gb == "1" &&...