1. Database:
Table 1: Region (ID, province)
Table 2: City (ID, city, province)
II. Code implementation:
<%
Function dbcombox ()
DIM RS, SQL, MSG
SQL = "SELECT * AROTION"
SET RS = Conn.execute (SQL)
While Not Rs.eof
MSG = msg & "
rs.movenext
Wend
Rs.close
SET RS = Nothing
DBCOMBOX = MSG
END FUNCTION
%>
hEAD>
CITYS = New Array ();
<%
DIM RS, SQL, I
SQL = "SELECT * from city"
SET RS = Conn.execute (SQL)
i = 0
While Not Rs.eof
%>
CITYS [<% = I%>] = new array ("<% = rs (" province ")%>", "<% = RS (" city ");"
<%
i = i 1
rs.movenext
Wend
Rs.close
SET RS = Nothing
%>
Function Changeselect (SelValue) {
Var sleelue = sleelue;
Var i;
Document.form1.city.length = 0;
Document.form1.city.Options [document.form1.city.length] = new option ("Please select", "");
For (i = 0; i IF (Citys [i] [0] == SELVALUE) { Document.form1.city.Options [document.form1.city .length] = new option (Citys [i] [1], citys [i] [1]); } } } Document.form1.city.Options [document.form1.city.length] = new option ("Please select", ""); script>