:::: 개발 ::::/::: JSCRIPT :::

select 값 컨트롤

nayha 2009. 12. 28. 14:10
반응형

 Dim prevComplex_Seq '바로 전 셀렉트값 기억변수
 
 prevComplex_Seq=Request("prevComplex_Seq")
 Complex_Seq = Request("Complex_Seq")

 if prevComplex_Seq<>Complex_Seq then
  strSelect_py = ""
 else
  strSelect_py = request("select_py") 
 end if

 

 

       <SCRIPT LANGUAGE="JavaScript">
              function change_si(var1)
              {
               document.form.strMainGuCD.value='';
               document.form.submit();
               return;
              }
              function change_gu(var1)
              {
               document.form.strMainGuName.value=var1; //selected 값 받아
               document.form.strMainDongCD.selectedIndex = 0; //다음 selected 값 초기화
               document.form.submit();
               return;
              }
              function change_dong(var1)
              {
               document.form.strMainDongName.value=var1;
               document.form.Complex_Seq.selectedIndex = 0;
               document.form.submit();
               return;
              }
              function change_mass(var1)
              {
               document.form.Complex_Seq.value = var1;
                //document.form.select_py.selectedIndex = 0;
               document.form.submit();
               return;
              }
              function change_py()
               {
               var strSpace;
               strSpace = document.form.select_py.options[document.form.select_py.selectedIndex].text;
               document.form.submit();
               return;
               }
             </SCRIPT>

<!-- 히든으로 값 받아두기 -->
                 <input type='hidden' name='strMainGuName' value='<%=request("strMainGuName")%>'>
              <input type='hidden' name='strGoodClsID' value='<%=request("strGoodClsID")%>'>
              <input type='hidden' name='strMainDongName' value='<%=request("strMainDongName")%>'>
              
              
<!-- 바로 전셀텍트값 기억 -->              
              <input type='hidden' name='prevComplex_Seq' value='<%=request("Complex_Seq")%>'>
              <input type='hidden' name='prevselect_py' value='<%=request("strSelect_py")%>'>

 

 

  <select name="Complex_Seq" class="font12_03" style="width:180px;" onchange="javascript:change_mass(document.form.Complex_Seq.value)"> <!-- 밸류값 넘김 -->
                <option value=''>단지선택</option>
              <%
                If request("strSiCode") <> "" And request("strMainGuCD") <> ""  And request("strMainDongCD") <> "" Then
                 objConn.CursorLocation = 3
                 With objCmd2
                  .ActiveConnection = objConn
                  .CommandText = "CM_SISE_APT_PROC"
                  .CommandType = adCmdStoredProc
                  .Parameters.Append .CreateParameter("@cls_Id", adChar, adParamInput, 4, strGoodClsID)
                  .Parameters.Append .CreateParameter("@str_DongCd",   adChar, adParamInput, 8, strMainDongCD)
                 End With
                 objRs.open objCmd2, , adOpenForwardOnly, adLockReadOnly, adCmdStoredProc
         
                 do while(Not objRs.EOF)
                 
              %>
                 <option value='<%=objRs("complex_name")%>'><%=objRs("complex_name")%></option>
              <%
                  objRs.MoveNext
                 Loop
                 objRs.close
                End if
              %>
               </select>
              <script language="javascript">document.form.Complex_Seq.value='<%=Complex_Seq%>';</script>

<!-- 선택된 밸류값을 날려 페이지에 내가 선택한 셀렉트 값이 남도록 한다 -->

 

 

           <select name="select_py" class="font12_03" style="width:85px;" onchange="javascript:change_py()">
             <option value=''>면적 선택</option>
               <object runat="Server" progid="ADODB.Command" id="objCmds"></object>
             <%
                 objConn.CursorLocation = 3
                 With objCmds
                  .ActiveConnection = objConn
                  .CommandText = "CM_SISE_APT_LIST_PROC"
                  .CommandType = adCmdStoredProc
                  .Parameters.Append .CreateParameter("@cls_Id", adChar, adParamInput, 4, strGoodClsID)
                  .Parameters.Append .CreateParameter("@str_DongCd", adChar, adParamInput, 8, strMainDongCD)
                  .Parameters.Append .CreateParameter("@str_AptName", advarChar, adParamInput, 30, Complex_Seq)
                  .Parameters.Append .CreateParameter("@str_Space_Seq", adChar, adParamInput, 5, blank)    
                  .Execute , , adExecuteNoRecords  
                 End With
                 
                 objRs.Open objCmds, , adOpenForwardOnly, adLockReadOnly, adCmdStoredProc
                 '면적  첫번째 값 기억하도록 설정
                i = 0
                do while(Not objRs.EOF)
                 If i=0 Then
                  If isEmpty(strSelect_py)=true or strSelect_py="" Then strSelect_py = objRs("space_seq")
                 End If
                 i = i + 1

             %>
                <option value='<%=objRs("space_seq")%>'> <%= objRs("space")%>㎡  &nbsp;<%=objRs("private_space")%> </option>
             <%
                 objRs.MoveNext
                  Loop
                objRs.close
             %>
                     </select>
                     <script language="javascript">document.form.select_py.value='<%=strSelect_py%>';</script>

 

 

복잡하다 -_-;; 좀더 간결해 지도록 노력해야것다 -0-;;;

 

반응형