ASP achieves provincial and university level-2 linkage (transfer, change)

Source: Internet
Author: User
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>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.