¾È±Ô °øºÎ¹æ

ACTIVE SERVER PAGE > DB µ¥ÀÌŸ ÀÚ¹Ù½ºÅ©¸³Æ® ¹è¿­¿¡ ³Ö±â

µî·ÏÀÏ : 2017-07-03 20:09 Á¶È¸¼ö : 53,734

<%
  Response.Write("<script LANGUAGE='javascript'>" & Chr(13))
  Response.Write("<!--" & Chr(13))
  Response.Write("var code1 = new Array()" & Chr(13))
  Response.Write("var area1 = new Array()" & Chr(13))
  Response.Write("var area2 = new Array()" & Chr(13))
 
  idx=0
  Set rs = Server.CreateObject("ADODB.RecordSet")
  SQL = "SELECT idx_num,area,idx_area FROM area2"
  rs.Open SQL, Conn

  Do Until rs.EOF
        code = rs("idx_num")
        name = rs("area")
        area = rs("idx_area")
        Response.Write("code1[" & idx & "] = '" & CStr(code) & "';")
        Response.Write("area1[" & idx & "] = '" & CStr(name) & "';")
        Response.Write("area2[" & idx & "] = '" & CStr(area) & "';")
        rs.MoveNext
        idx = idx + 1
  Loop

rs.Close

%>
-->
</script>

<script language='javascript'>
<!--
  function change_area(form,k)
  {
        var cnt = 0, i;
        for(i = 0; i < form.area2.length; i++);
                form.area2.options[i] = null;
        form.area2.length = 0;
        form.area2.options[cnt++] = new Option('¼±ÅÃ','0');
        for(i = 0; i < code1.length; i++)
        {
                if(form.area1.options[k].value == code1[i])
                {
                        form.area2.options[cnt++] = new Option(area1[i],area2[i]);
                }
        }
}   
-->
</script>

' ½ÇÁ¦ ÄÚµù ºÎºÐ...--------------------------------------

  <select name="area1" onchange="change_area(this.form,form.area1.selectedIndex)">
        <option value="0">[¼±ÅÃ]
        <%
Set rs = Server.CreateObject("ADODB.RecordSet")
SQL = "SELECT idx_num,area FROM area1 order by idx_num"
rs.Open SQL, Conn
        %> 

        <%
        do while not rs.EOF 
        %>
           
              <option value="<%=rs("idx_num")%>"><%=rs("area")%>
<%
rs.movenext
loop
%>
        </select>
        <select name="area2">
              <option value="0">[¼±ÅÃ]
  </select>

 
ÀÏ´Ü À§ÀÇ ¿¹Á¦¸¦ º¸±â Àü¿¡,,, ÀÚ¹Ù½ºÅ©¸³ °­Á¿¡ -> form¿¡°ü·ÃµÈ ÆÁ -> select ÆÁ À» °¡¼­
È®ÀÎÇØ º»ÈÄ Å×½ºÆ® ÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù.
 
±× ¿¹Á¦ÀÇ µ¥ÀÌŸ¸¦ µðºñ¿¡¼­ °¡Áö°í ¿Â´Ù°í °¡Á¤À» ÇßÀ»¶§, »ç¿ëÇÒ¼ö ÀÖ´Â ¿¹Á¦ ÀÔ´Ï´Ù.
 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.