<Form name = myform method = post action = ''>
<Tr bgcolor = "# f6fafd"> <%
Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open "select categoryid, category from category where first = 1 order by categoryorder", Conn, 1, 1
If Rs. EOF and Rs. bof then
Response. Write "<tr> <TD align = center> NO product category </TD> </tr>"
Else
%>
<TD Height = "30" colspan = "2" align = "center"> <SPAN class = "style16">
<Select name = "categoryid" onchange = "changelocation (document. myform. categoryid. Options [document. myform. categoryid. selectedindex]. Value)">
<Option value = "---- brand ----" selected> ---- brand ---- </option>
<% Do while not Rs. EOF %>
<Option value = "<% = trim (RS (" categoryid ") %>"> <% = trim (RS ("category") %> </option>
<%
Rs. movenext
Loop
End if
Rs. Close
Set rs = nothing
'Conn. Close
'Set conn = nothing
%>
</SELECT>
</Span> </TD>
</Tr>
<Tr bgcolor = "# f6fafd">
<TD Height = "30" colspan = "2" align = "center"> <SPAN class = "style16">
<Select name = "sortsid">
<Option selected value> --- Select a category --- </option>
</SELECT>
</Span> </TD>
</Tr> </form>
<Script language = "JavaScript">
VaR onecount;
Onecount = 0;
Subcat = new array ();
<%
Count = 0
Do while not rs1.eof
%>
Subcat [<% = count %>] = new array ("<% = trim (RS1 (" Sorts ") %> ", "<% = trim (RS1 (" categoryid ") %>", "<% = trim (RS1 (" sortsid ") %> ");
<%
Count = count + 1
Rs1.movenext
Loop
Rs1.close
%>
Onecount = <% = count %>;
Function changelocation (locationid)
...{
Document. myform. sortsid. Length = 0;
VaR locationid = locationid;
VaR I;
For (I = 0; I <onecount; I ++)
...{
If (subcat [I] [1] = locationid)
...{
Document. myform. sortsid. Options [document. myform. sortsid. Length] = New Option (subcat [I] [0], subcat [I] [2]);
}
}
}
</SCRIPT>
Note: 1. Storage sequence of the array (which is the same as the value of the first-level menu) 2. Use double quotation marks (") in the array. 3. javascript: New Option (text, value)