'Retrieve sub-category in RS1
Dim count
Set RS1 = server. Createobject ("ADODB. recordset ")
SQL = "select * From jxkhzbzzfl order by zzfl_id ASC"
Rs1.open SQL, Conn, 1, 1
'-----------------------------------------
'Write the subcategory record to the array subcat (subclass name, parent ID, child id
'-----------------------------------------
%>
<Script language = "JavaScript">
VaR onecount;
Onecount = 0;
Subcat = new array ();
<% COUNT = 0
Do while not rs1.eof %>
Subcat [<% = count %>] = new array ("<% = trim (RS1 (" zzfl_name ") %> ", "<% = trim (RS1 (" year ") %>", "<% = trim (RS1 (" zzfl_id ") %> ");
<% COUNT = count + 1
Rs1.movenext
Loop
Rs1.close
%>
// List all subcategories in the array subcat for later use
// Var subcat = new array ();
// Subcat [0] = new array ('10', '1', '= 1 ')
// Subcat [1] = new array ('10', '2', '= 2 ')
// Subcat [0] [0] = '10' // RS1 ("zfl_name ")
// Subcat [0] [1] = '1' // RS1 ("zzfl_id ")
// Subcat [0] [2] = '= 1' // RS1 ("zfl_id ")
// Subcat [1] [0] = '10'
// Subcat [1] [1] = '2'
// Subcat [1] [2] = '= 2'
//.....
Onecount = <% = count %>;
Function changelocation (locationid)
{
Document. Form. zzfl_id.length = 0;
VaR locationid = locationid;
VaR I;
For (I = 0; I <onecount; I ++)
{
If (subcat [I] [1] = locationid )//
{
Document. Form. zzfl_id.options [document. Form. zzfl_id.length] = New Option (subcat [I] [0], subcat [I] [2]);
// Document. Form. zzfl_id.length is 0 for the first time, and all subclasses of a certain category are exceeded.
}
}
}
// Onchange = "changelocation (this. Options. selectindex )"
// It should be onchange = "changelocation (this. Options. selectedindex )"
// New Option (); It should be new option (); // an O in upper case
// <Select id = "S">
// </SELECT>
// Var option = New Option ("ABC", "2312 ");
// Document. All. S. Options [0] = option;
// Var option2 = New Option ("def", "2312 ");
// Document. All. S. Options [1] = option2;
// Option is the select option, str1 is the description displayed on the page, and str2 is the value of this item, such
// <Option value = "str2"> str1 </option>
// New Option (); generally used to dynamically generate and select a project
</SCRIPT>
Level 1
<Select name = "my1"Onchange = "changelocation (document. Form. my1.options [document. Form. my1.selectedindex]. Value )">
<Option value = "2008" <% if myear = "2008" then %> selected <% end if %> 2008 </option>
<Option value = "2009" <% if myear = "2009" then %> selected <% end if %> 2009 </option>
</SELECT>
Level 2
<Select name = "zzfl_id">
<%
Set rs2 = server. Createobject ("ADODB. recordset ")
Rs2.open "select * From jxkhzbzzfl where year = '" & myear & "'", Conn, 1, 1
If rs2.eof then
Else
Do while not rs2.eof
If CSTR (rs2 ("zzfl_id") = CSTR (mzzfl_id) then
%>
<Option value = "<% = rs2 (" zzfl_id ") %>" selected> <% = rs2 ("zzfl_name") %> </option>
<% Else %>
<Option value = "<% = rs2 (" zzfl_id ") %>"> <% = rs2 ("zzfl_name") %> </option>
<% End if
Rs2.movenext
Loop
Rs2.close
Set rs2 = nothing
End if
%> </SELECT>