[질문] 셀렉트 선택시 해당 조건 내용 출력하기?

· 2009-11-19 (목) 16:02:35 · 1552 · 3
안녕하세요~
게시판에 질문만 드리는 불량 수다쟁이 입니다..

혼자 끙끙거리다 조언을 구하고자 이렇게 글을 올려요~ ㅠㅠ

내요은 다음과 같습니다.

셀렉트를 선택하는것에 따라서 해당 목록이 바뀌고자 합니다.

셀렉트에, 사과, 포도, 오렌지 가 있고, 오랜지를 선택 했다면

오렌지의 해당 폼이 출력이 되게 하고자 합니다.

간단하고 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>
|

댓글 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>
2009-11-19 (목) 17:01:56
아~ 요렇게 해도 되겠네용~~
슁~하니 적용하고 오겠습니다~~^^ 옵션님 감사합니다~
댓글을 작성하시려면 로그인이 필요합니다.

자유게시판

202,925건
+
제목 글쓴이 날짜 조회
09-11-19 조회 1,315
09-11-19 조회 1,418
09-11-19 조회 1,748
09-11-19 조회 1,298
09-11-19 조회 1,293
09-11-19 조회 1,266
09-11-19 조회 1,314
09-11-19 조회 1,501
09-11-19 조회 4,538
09-11-19 조회 1,328
09-11-19 조회 1,302
09-11-19 조회 1,724
09-11-19 조회 2,065
09-11-19 조회 1,339
09-11-19 조회 1,820
09-11-19 조회 1,550
09-11-19 조회 4,757
09-11-19 조회 1,553
09-11-19 조회 1,873
09-11-19 조회 1,625