묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
셀렉트문에 자바스크립트 어떻게 넣죠?
2003.12.30 13:38
해당 셀렉트의 옵션이 선택될때 주소1 혹은 주소2가 보이게 할려고 하는데요.
아래와 같이 한게 잘못 되었나요?
스크립트는 호출되었을때 아래의exp_1 or 2 가 none이라면 그 none을 없애게 하는거구요.
<tr>
<td>직위:</td>
<td><select name="mJob" size="1">
<option value="not">선택</option>
<option value="교수" onSelect=javascript:viewAddr('exp_1');>교수</option>
<option value="연구원" onSelect=javascript:viewAddr('exp_1');>연구원</option>
<option value="조교" onSelect=javascript:viewAddr('exp_1');>조교</option>
<option value="직원" onSelect=javascript:viewAddr('exp_1');>직원</option>
<option value="학생" onSelect=javascript:viewAddr('exp_2');>학생</option>
<option value="기타" onSelect=javascript:viewAddr('exp_2');>기타</option>
</select>
</td>
</tr>
<tr id =exp_1 style="display:none;">
<td>주소:</td>
<td>
<input type="text" name="mAddrPost1" size="3"> - <input type="text" name="mAddrPost2" size="3">
<input type="text" name="mAddrPost2" size="26"><input type="button" onClick="javascript:SearchZip();" value="주소찾기"><br>
<input type="text" name="mAddrPost3" size="38">
</td>
</tr>
<tr id =exp_2 style="display:none;">
<td>주소:</td>
<td>
<input type="text" name="mAddr1" size="3"> - <input type="text" name="mAddrPost2" size="3">
<input type="text" name="mAddr2" size="26"><input type="button" onClick="javascript:SearchZip();" value="주소찾기"><br>
<input type="text" name="mAddr3" size="38">
</td>
</tr>
아래와 같이 한게 잘못 되었나요?
스크립트는 호출되었을때 아래의exp_1 or 2 가 none이라면 그 none을 없애게 하는거구요.
<tr>
<td>직위:</td>
<td><select name="mJob" size="1">
<option value="not">선택</option>
<option value="교수" onSelect=javascript:viewAddr('exp_1');>교수</option>
<option value="연구원" onSelect=javascript:viewAddr('exp_1');>연구원</option>
<option value="조교" onSelect=javascript:viewAddr('exp_1');>조교</option>
<option value="직원" onSelect=javascript:viewAddr('exp_1');>직원</option>
<option value="학생" onSelect=javascript:viewAddr('exp_2');>학생</option>
<option value="기타" onSelect=javascript:viewAddr('exp_2');>기타</option>
</select>
</td>
</tr>
<tr id =exp_1 style="display:none;">
<td>주소:</td>
<td>
<input type="text" name="mAddrPost1" size="3"> - <input type="text" name="mAddrPost2" size="3">
<input type="text" name="mAddrPost2" size="26"><input type="button" onClick="javascript:SearchZip();" value="주소찾기"><br>
<input type="text" name="mAddrPost3" size="38">
</td>
</tr>
<tr id =exp_2 style="display:none;">
<td>주소:</td>
<td>
<input type="text" name="mAddr1" size="3"> - <input type="text" name="mAddrPost2" size="3">
<input type="text" name="mAddr2" size="26"><input type="button" onClick="javascript:SearchZip();" value="주소찾기"><br>
<input type="text" name="mAddr3" size="38">
</td>
</tr>
<select name="mJob" size="1" OnChange="해당 function">
이렇게 넣어주시면 됩니다.