배열 부분을 쿼리로 처리가 가능할까요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

배열 부분을 쿼리로 처리가 가능할까요? 정보

배열 부분을 쿼리로 처리가 가능할까요?

본문

아래 소스는 다중콤보 박스 인데요..

  data_1 = new Option("대우", "대우");

이 부분을 쿼리로 받아오고 싶은데, 전혀 감이 오지 않습니다..
어떤방법으로 처리하면 좋을까요?
<script language="JavaScript" type="text/javascript">
<!--
// first combo box
  data_1 = new Option("대우", "대우");
  data_2 = new Option("현대", "현대");
  data_3 = new Option("기아", "기아");
  data_4 = new Option("쌍용", "쌍용");
  data_5 = new Option("아우디", "아우디");
  data_6 = new Option("뻰츠", "벤츠");
// second combo box
  data_1_1 = new Option("대우차", "대우차");
  data_1_2 = new Option("대우차2", "대우차2");
  data_1_3 = new Option("대우차3", "대우차3");
  data_2_1 = new Option("현대차", "현대차");
  data_2_2 = new Option("현대차2", "현대차");
  data_2_3 = new Option("23", "--");
  data_2_4 = new Option("24", "--");
  data_2_5 = new Option("25", "--");
// third combo box
  data_1_1_1 = new Option("승용", "승용");
  data_1_2_1 = new Option("SUV", "SUV");
  data_1_3_1 = new Option("기타1", "기타1");
  data_1_3_2 = new Option("기타2", "기타2");
  data_1_4_1 = new Option("기타", "기타");
  data_1_4_2 = new Option("기타2", "기타2");

  data_2_1_1 = new Option("211", "**");
  data_2_1_2 = new Option("212", "**");
  data_2_2_1 = new Option("221", "**");
  data_2_2_2 = new Option("222", "**");
  data_2_3_1 = new Option("231", "***");
  data_2_3_2 = new Option("232", "***");
// fourth combo box
  data_1_1_1_1 = new Option("1111","1111")
  data_1_2_1_1 = new Option("1211","1211")
  data_1_3_1_1 = new Option("1311","1311")
  data_1_3_2_1 = new Option("1321","1321")
  data_1_3_3_1 = new Option("1331","1331")
  data_1_3_4_1 = new Option("1341","1341")
  data_1_4_1_1 = new Option("1411","1411")
  data_1_4_2_1 = new Option("1421","1421")
  data_1_4_3_1 = new Option("1431","1431")
  data_1_4_4_1 = new Option("1441","1441")
  data_1_5_1_1 = new Option("1511","1511")
  data_1_5_2_1 = new Option("1521","1521")
  data_1_5_3_1 = new Option("1531","1531")
  data_1_5_4_1 = new Option("1541","1541")
  data_1_6_1_1 = new Option("1611","1621")
  data_1_6_2_1 = new Option("1621","1621")
  data_1_6_3_1 = new Option("1631","1631")
  data_1_6_4_1 = new Option("1641","1641")
  data_2_2_1_1 = new Option("2211","%")
  data_2_2_1_1 = new Option("2211","%")
  data_2_2_1_2 = new Option("2212","2212")
// other parameters
  displaywhenempty="-선택없음-"
  valuewhenempty=""
  displaywhennotempty="- 항목선택↓  -"
  valuewhennotempty=""

function change(currentbox) {
  numb = currentbox.id.split("_");
  currentbox = numb[1];
  i=parseInt(currentbox)+1
// I empty all combo boxes following the current one
  while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
          (document.getElementById("combo_"+i)!=null)) {
        son = document.getElementById("combo_"+i);
        // I empty all options except the first one (it isn't allowed)
        for (m=son.options.length-1;m>0;m--) son.options[m]=null;
        // I reset the first option
        son.options[0]=new Option(displaywhenempty,valuewhenempty)
        i=i+1
  }

// now I create the string with the "base" name ("stringa"), ie. "data_1_0"
// to which I'll add _0,_1,_2,_3 etc to obtain the name of the combo box to fill
  stringa='data'
  i=0
  while ((eval("typeof(document.getElementById(\"combo_"+i+"\"))!='undefined'")) &&
          (document.getElementById("combo_"+i)!=null)) {
          eval("stringa=stringa+'_'+document.getElementById(\"combo_"+i+"\").selectedIndex")
          if (i==currentbox) break;
          i=i+1
  }

// filling the "son" combo (if exists)
  following=parseInt(currentbox)+1
  if ((eval("typeof(document.getElementById(\"combo_"+following+"\"))!='undefined'")) &&
      (document.getElementById("combo_"+following)!=null)) {
      son = document.getElementById("combo_"+following);
      stringa=stringa+"_"
      i=0
      while ((eval("typeof("+stringa+i+")!='undefined'")) || (i==0)) {
      // if there are no options, I empty the first option of the "son" combo
      // otherwise I put "-select-" in it
            if ((i==0) && eval("typeof("+stringa+"0)=='undefined'"))
                if (eval("typeof("+stringa+"1)=='undefined'"))
                  eval("son.options[0]=new Option(displaywhenempty,valuewhenempty)")
                else
                eval("son.options[0]=new Option(displaywhennotempty,valuewhennotempty)")
        else
            eval("son.options["+i+"]=new Option("+stringa+i+".text,"+stringa+i+".value)")
        i=i+1
      }
      //son.focus()
      i=1
      combostatus=''
      cstatus=stringa.split("_")
      while (cstatus[i]!=null) {
        combostatus=combostatus+cstatus[i]
        i=i+1
        }
      return combostatus;
  }
}
//-->
</script>

댓글 전체

전체 66,558 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT