onchange div select 선택시 인풋 박스 바꾸기


<script type="text/javascript">
 function jsChselect(tar){
  if(tar=="0"){
   //텍스트 입력 보이기
   document.getElementById("lytext1").style.display = "block";
   document.getElementById("lytext2").style.display = "none";
  }else{
   //텍스트 입력 보이지 않기
   document.getElementById("lytext2").style.display = "block";
   document.getElementById("lytext1").style.display = "none";
  }
 }
 </script>


<tr>
<td width='50%' align='center' colspan="2"><font color=red>*</font>Point 적립 (적립기준 : )
<select name="select1" onChange="javascript:jsChselect(this.value);">
         <option value="0" checked>%기준</option>
         <option value="1" checked>금액기준</option></select></td>
</tr>
<div name="lytext" id="lytext1">
<tr>
<td  width='50%' align='center' colspan="2"><font color=red>*</font>현금결제 <input type='text' name="myText1" >% 적립</td>
</tr>
<tr>
<td  width='50%' align='center' colspan="2"><font color=red>*</font>기타금액결제 <input type='text' name="myText2">% 적립</td>
</tr>
</div>
<div name="lytext" id="lytext2" style="display:none">
<tr>
<td  width='50%' align='center' colspan="2" name="k2"><font color=red>*</font>현금결제1 <input type='text' name="myText3" >원당 1Point 적립</td>
</tr>
<tr>
<td  width='50%' align='center' colspan="2" name="k2"><font color=red>*</font>기타금액결제1 <input type='text' name="myText4">원당 1Point 적립</td>
</tr>
</div>

댓글