GNUAPP

3단셀렉트 오류문의를 드립니다.

· 14년 전 · 1026
안녕하세요. 3단셀렉트 오류문의를 드립니다.

셀렉트에 오류가 있는것 같아요.
셀렉트 1번에 항목이 3개면, 2번이 2개더라도 3개로 나와버려요.
앞의 수량을 뒤에 셀렉트가 그대로 가져가는것 같아요.
아래는 적용한 3단셀렉트 소스입니다.
어디 부분에 오류가 있는것 같은데, 고수님들의 도움 부탁 드립니다.



3단 셀렉트 소스

<SCRIPT LANGUAGE="JavaScript">
<!--
// select a의 선택 값을 이용해 select b의 선택 값을 생성
function change_option_a(form) {
if(form.coa.options[form.coa.selectedIndex].value != 0) {
// 예를들어 select a에서 선택된 값의 value가 s1이라고 했을시 아래 명령과 동일하다
// change_option_a_s1(form);
eval('change_option_a_'+form.coa.options[form.coa.selectedIndex].value+'(form);');
} else {
// value값으로 0을 가지는option을 선택시 명령
}
}

// select b의 선택 값을 이용해 select c의 선택 값을 생성
function change_option_b(form) {
if(form.cob.options[form.cob.selectedIndex].value != 0) {
// 예를들어 select b에서 선택된 값의 value가 s11이라고 했을시 아래 명령과 동일하다
// change_option_a_s11(form);
eval('change_option_b_'+form.cob.options[form.cob.selectedIndex].value+'(form);');
} else {
// value값으로 0을 가지는option을 선택시 명령
}
}

// select a,b,c에서 선택한 text와 value값을 출력
function change_option_result(form) {
// text
alert('[Text]\nSELECT A : '+form.coa.options[form.coa.selectedIndex].text+ // select a
'\nSELECT B : '+form.cob.options[form.cob.selectedIndex].text+ // select b
'\nSELECT C : '+form.coc.options[form.coc.selectedIndex].text+ // select c
'\n\n========================='+
// value
'\n\n[Value]\nSELECT A : '+form.coa.options[form.coa.selectedIndex].value+ // select a
'\nSELECT B : '+form.cob.options[form.cob.selectedIndex].value+ // select b
'\nSELECT C : '+form.coc.options[form.coc.selectedIndex].value); // select c
}

// select a에서 select 1을 선택시 select b에서 보여지는 값
function change_option_a_s1(form) {
form.cob.options[0] = new Option("SELECT B 1",0); // new Option('text','value');
form.cob.options[1] = new Option("Select 1 1","s11");
form.cob.options[2] = new Option("Select 1 2","s12");
form.cob.options[3] = new Option("Select 1 3","s13");
}

// select a에서 select 2를 선택시 select b에서 보여지는 값
function change_option_a_s2(form) {
form.cob.options[0] = new Option("SELECT B 2",0);
form.cob.options[1] = new Option("Select 2 1","s21");
form.cob.options[2] = new Option("Select 2 2","s22");
}

// select b에서 select 1 1을 선택시 select c에서 보여지는 값
function change_option_b_s11(form) {
form.coc.options[0] = new Option("SELECT C 1 1",0);
form.coc.options[1] = new Option("Select 1 1 1","s111");
form.coc.options[2] = new Option("Select 1 1 2","s112");
}

// select b에서 select 1 2를 선택시 select c에서 보여지는 값
function change_option_b_s12(form) {
form.coc.options[0] = new Option("SELECT C 1 2",0);
form.coc.options[1] = new Option("Select 1 2 1","s121");
form.coc.options[2] = new Option("Select 1 2 2","s122");
}

// select b에서 select 2 1을 선택시 select c에서 보여지는 값
function change_option_b_s21(form) {
form.coc.options[0] = new Option("SELECT C 2 1",0);
form.coc.options[1] = new Option("Select 2 1 1","s211");
form.coc.options[2] = new Option("Select 2 1 2","s212");
}

// select b에서 select 2 2를 선택시 select c에서 보여지는 값
function change_option_b_s22(form) {
form.coc.options[0] = new Option("SELECT C 2 2",0);
form.coc.options[1] = new Option("Select 2 2 1","s221");
form.coc.options[2] = new Option("Select 2 2 2","s222");
}
//-->
</SCRIPT>

<FORM NAME="form">

<SELECT NAME="coa" onChange="change_option_a(this.form);">
<OPTION VALUE="0">SELECT A</OPTION>
<OPTION VALUE="s1">Select 1</OPTION>
<OPTION VALUE="s2">Select 2</OPTION>
</SELECT>

<SELECT NAME="cob" onChange="change_option_b(this.form);">
<OPTION VALUE="0">SELECT B</OPTION>
</SELECT>

<SELECT NAME="coc">
<OPTION VALUE="0">SELECT C</OPTION>
</SELECT>

<INPUT TYPE="button" VALUE="click" onClick="change_option_result(this.form);">

</FORM><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
14년 전 조회 2,375
14년 전 조회 1,946
14년 전 조회 1,591
14년 전 조회 3,673
14년 전 조회 2,143
14년 전 조회 1,596
14년 전 조회 1,437
14년 전 조회 2,131
14년 전 조회 1,527
14년 전 조회 1,328
14년 전 조회 1,259
14년 전 조회 2,515
14년 전 조회 1,165
14년 전 조회 1,391
14년 전 조회 2,185
14년 전 조회 1,515
14년 전 조회 1,496
14년 전 조회 2,041
14년 전 조회 1,715
14년 전 조회 1,790
14년 전 조회 1,589
14년 전 조회 2,882
14년 전 조회 1,673
14년 전 조회 1,342
14년 전 조회 1,568
14년 전 조회 1,327
14년 전 조회 1,352
14년 전 조회 1,194
14년 전 조회 1,398
14년 전 조회 1,783
14년 전 조회 2,023
14년 전 조회 1,514
14년 전 조회 1,671
14년 전 조회 1,500
14년 전 조회 1,685
14년 전 조회 1,946
14년 전 조회 1,716
14년 전 조회 1,950
14년 전 조회 1,703
14년 전 조회 1,629
14년 전 조회 1,650
14년 전 조회 1,627
14년 전 조회 2,145
14년 전 조회 2,081
14년 전 조회 1,892
14년 전 조회 2,005
14년 전 조회 2,234
14년 전 조회 1,214
14년 전 조회 1,682
14년 전 조회 1,027
14년 전 조회 1,506
14년 전 조회 1,980
14년 전 조회 1,408
14년 전 조회 1,488
14년 전 조회 1,721
14년 전 조회 1,926
14년 전 조회 1,778
14년 전 조회 1,465
14년 전 조회 1,763
14년 전 조회 1,985
14년 전 조회 1,943
14년 전 조회 1,502
14년 전 조회 2,690
14년 전 조회 1,029
14년 전 조회 1,668
14년 전 조회 1,505
14년 전 조회 1,333
14년 전 조회 1,830
14년 전 조회 2,271
14년 전 조회 1,633
14년 전 조회 1,391
14년 전 조회 1,420
14년 전 조회 1,678
14년 전 조회 1,988
14년 전 조회 2,078
14년 전 조회 1,129
14년 전 조회 1,678
14년 전 조회 1,583
14년 전 조회 1,595
14년 전 조회 2,367
14년 전 조회 2,150
14년 전 조회 1,963
14년 전 조회 1,711
14년 전 조회 1,744
14년 전 조회 2,342
14년 전 조회 1,392
14년 전 조회 1,140
14년 전 조회 1,443
14년 전 조회 1,404
14년 전 조회 1,887
14년 전 조회 2,155
14년 전 조회 1,903
14년 전 조회 1,538
14년 전 조회 1,616
14년 전 조회 1,703
14년 전 조회 3,429
14년 전 조회 1,625
14년 전 조회 2,304
14년 전 조회 1,914
14년 전 조회 1,538