[질문] 셀렉트 선택시 해당 조건 내용 출력하기? 정보
[질문] 셀렉트 선택시 해당 조건 내용 출력하기?본문
안녕하세요~
게시판에 질문만 드리는 불량 수다쟁이 입니다..
혼자 끙끙거리다 조언을 구하고자 이렇게 글을 올려요~ ㅠㅠ
내요은 다음과 같습니다.
셀렉트를 선택하는것에 따라서 해당 목록이 바뀌고자 합니다.
셀렉트에, 사과, 포도, 오렌지 가 있고, 오랜지를 선택 했다면
오렌지의 해당 폼이 출력이 되게 하고자 합니다.
간단하고 If 문 으로 선택해서 해당 내용이 보이게 하려고 했는데..
되지 않네요^^;;;
getElementByTagnode 로 불려 오려고 해도... 감이 오질 않아서요..
조언 및 도움 부탁 드리겠습니다.
<script>
function setCode()
{
var v_code = theForm.code.value;
alert(v_code); //셀렉트 위치
}
<form name="theForm">
<select name="code" onChange="setCode();">
<option value="">종류</option>
<option value="1140" <?=($code=="1140")?"selected":""?>>사과</option>
<option value="3140" <?=($code=="3140")?"selected":""?>>포도</option>
<option value="2140" <?=($code=="2140")?"selected":""?>>오랜지</option>
</select>
<table>
<? if ($v_code=="2130") { ?>
<tr>
<td>
<iframe name="cityFrame" id="naverFrame" frameborder="0" border="0" scrolling="no" width="150" height="21">오랜지 폼로딩</iframe>
</td>
</tr>
<? } else { ?>
<tr>
<td>
<iframe name="cityFrame" id="daumFrame" frameborder="0" border="0" scrolling="no" width="150" height="21">사과,포토 폼 로딩</iframe>
</td>
</tr>
<? } ?>
</table>
</form>
게시판에 질문만 드리는 불량 수다쟁이 입니다..
혼자 끙끙거리다 조언을 구하고자 이렇게 글을 올려요~ ㅠㅠ
내요은 다음과 같습니다.
셀렉트를 선택하는것에 따라서 해당 목록이 바뀌고자 합니다.
셀렉트에, 사과, 포도, 오렌지 가 있고, 오랜지를 선택 했다면
오렌지의 해당 폼이 출력이 되게 하고자 합니다.
간단하고 If 문 으로 선택해서 해당 내용이 보이게 하려고 했는데..
되지 않네요^^;;;
getElementByTagnode 로 불려 오려고 해도... 감이 오질 않아서요..
조언 및 도움 부탁 드리겠습니다.
<script>
function setCode()
{
var v_code = theForm.code.value;
alert(v_code); //셀렉트 위치
}
<form name="theForm">
<select name="code" onChange="setCode();">
<option value="">종류</option>
<option value="1140" <?=($code=="1140")?"selected":""?>>사과</option>
<option value="3140" <?=($code=="3140")?"selected":""?>>포도</option>
<option value="2140" <?=($code=="2140")?"selected":""?>>오랜지</option>
</select>
<table>
<? if ($v_code=="2130") { ?>
<tr>
<td>
<iframe name="cityFrame" id="naverFrame" frameborder="0" border="0" scrolling="no" width="150" height="21">오랜지 폼로딩</iframe>
</td>
</tr>
<? } else { ?>
<tr>
<td>
<iframe name="cityFrame" id="daumFrame" frameborder="0" border="0" scrolling="no" width="150" height="21">사과,포토 폼 로딩</iframe>
</td>
</tr>
<? } ?>
</table>
</form>
추천
0
0
댓글 3개

onchange로 폼은 가만히 냅두시고 입력필드만 보였다 감췄다하시는게 어떠실지

<script>
function setCode(){
if(document.all.code.value=="오랜지"){
cityFrame.location.href="http://오랜지 폼어디?";
}
if(document.all.code.value=="사과,포토"){
cityFrame.location.href="http://사과,포토 폼 어디?";
}
}
</script>
<select name="code" onChange="setCode();">
<option value=menu1>사과
<option value=menu2>사과,포토
</select>
<iframe name="cityFrame" id="naverFrame" frameborder="0" border="0" scrolling="no" width="150" height="21">폼로딩</iframe>
function setCode(){
if(document.all.code.value=="오랜지"){
cityFrame.location.href="http://오랜지 폼어디?";
}
if(document.all.code.value=="사과,포토"){
cityFrame.location.href="http://사과,포토 폼 어디?";
}
}
</script>
<select name="code" onChange="setCode();">
<option value=menu1>사과
<option value=menu2>사과,포토
</select>
<iframe name="cityFrame" id="naverFrame" frameborder="0" border="0" scrolling="no" width="150" height="21">폼로딩</iframe>
아~ 요렇게 해도 되겠네용~~
슁~하니 적용하고 오겠습니다~~^^ 옵션님 감사합니다~
슁~하니 적용하고 오겠습니다~~^^ 옵션님 감사합니다~