Today, two-level linkage is used in the company's projects, or ASP. NET. I haven't moved ASP for a long time.
I found some information on the Internet and changed it. Implemented this function,CodeAs follows:
ASP second-level linkage
Province table: Sheng: Sid, stitle. School table: Cid, ctitle, Sid
<! -- # Include file = "../SUB/Conn. asp" -->
<HTML> <SCRIPT type = "text/JavaScript">
<! --
Function mm_jumpmenu (targ, selobj, restore) {// V3.0
Eval (targ + ". Location = '" + selobj. Options [selobj. selectedindex]. Value + "'");
If (Restore) selobj. selectedindex = 0;
}
// -->
</SCRIPT>
</Head>
<Body>
<Form method = "Post" name = "myform" id = "myform">
<Select name = "first" onchange = "mm_jumpmenu ('parent', this, 0)">
<%
Sqlt2 = "select * From Sheng"
Set rst2 = server. Createobject ("ADODB. recordset ")
Rst2.open sqlt2, Conn, 0, 1
If rst2.eof or rst2.bof then
Response. Write "<option>-select-</option>" '. If no record exists -----
Else
While not (rst2.eof or rst2.bof) 'has a record, and the parent name is listed to form a drop-down list.
%>
<Option value = "? SEC = <% = rst2 ("Sid") %> & class_1 = <% = rst2 ("stitle") %> "<% if CSTR (rst2 (" Sid ")) = request. querystring ("Sec") Then %> selected <% end if % >><%= rst2 ("stitle") %> </option>
<% Rst2.movenext
Wend
Rst2.movefirst move the cursor to the first entry for use below.
End if
%>
</SELECT>
<Input name = "class_1" type = "hidden" id = "class_1" value = "<% = request (" class_1 ") %>">
<Select name = "second">
<%
If rst2.eof or rst2.bof then
Response. Write ("<option>-select-</option> ")
Else
If request. querystring ("Sec") = "" then "Get the SEC value after the jump
Temp = rst2 ("Sid") 'if it is null, set the Temp value to the value of the first record.
Else
Temp = request. querystring ("Sec ")'
End if
Subsql = "select * from school where Sid =" & temp &""
Set subrs = server. Createobject ("ADODB. recordset ")
Subrs. Open subsql, Conn, 0, 1
If subrs. EOF or subrs. bof then
Response. Write ("<option>-select-</option> ")
'If no record exists, "-----" is displayed in this list "-----"
Else
While not (subrs. EOF or subrs. bof) 'otherwise, all qualified records will be listed cyclically.
Response. Write ("<option value =" & subrs ("ctitle") & ">" & subrs ("ctitle") & "</option> ")
Subrs. movenext
Wend
End if
End if
'Close all Record Sets
Subrs. Close
Set subrs = nothing
Rst2.close
Set rst2 = nothing
%>
</SELECT>
</Form>