JS script:
<%
Dim rs
Dim SQL
Dim count
Dim RS1
Dim sql1
SQL = "select * From region order by zoneid ASC"
Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open SQL, Conn, 1, 3
%>
<Script language = "JavaScript">
VaR onecount;
Onecount = 0;
Subcat = new array ();
<%
Count = 0
Do while not Rs. EOF
%>
Subcat [<% = count %>] = new array ("<% = trim (RS (" regionname ") %> ", "<% = trim (RS (" zoneid ") %>", "<% = trim (RS (" regionid ") %> ");
<%
Count = count + 1
Rs. movenext
Loop
Rs. Close
Set rs = nothing
%>
Onecount = <% = count %>;
Function changelocation (zoneid)
{
Document. myform. region. Length = 0;
VaR zoneid = zoneid;
VaR I;
Document. myform. region. Options [0] = New Option ('-- region --','');
For (I = 0; I <onecount; I ++)
{
If (subcat [I] [1] = zoneid)
{
Document. myform. region. Options [document. myform. region. Length] = New Option (subcat [I] [0], subcat [I] [2]);
}
}
}
</SCRIPT>
Form Content:
<Table>
<Form>
<Tr>
<TD>
<SPAN class = "style1"> * </span> region:
<Select name = "zone" size = "1" id = "zone" onchange = "changelocation (document. myform. zone. options [document. myform. zone. selectedindex]. value) ">
<Option value = 0 selected> select </option>
<%
Sql1 = "select * From bigzone order by zonename ASC"
Set RS1 = server. Createobject ("ADODB. recordset ")
Rs1.open sql1, Conn, 1, 3
%>
<% While not rs1.eof %>
<Option value = "<% = RS1 (" zoneid ") %>"> <% = RS1 ("zonename") %> </option>
<% Rs1.movenext
Wend
Rs1.close
Set RS1 = nothing
%>
</SELECT> </TD>
<TD width = "20%"> <SPAN class = "style1"> * </span> region:
<Select name = "region" size = "1" id = "region">
<Option value = 0 selected> select </option>
</SELECT>
</Tr>
</Form>
</Table>