Net cascade menu

Source: Internet
Author: User

Net cascade menu

DepartmentName = "department name"
Set repeated mentrs = server. CreateObject ("adodb. recordset ")
DepartmentSql = "select * from [s_department] order by [id] asc"
DepartmentRs. open departmentSql, conn
Do while not parse mentrs. eof
DepartmentName = departmentName & "|" & departmentRs ("department ")
Inclumentid = inclumentid & "|" & inclumentrs ("ID ")
DepartmentRs. movenext
Loop
Set dimension mentrs = nothing
DepartmentName = departmentName & "| unassigned Department"
Required mentid = required mentid & "| 0"
DepartmentName_array = split (departmentName, "| ")
Repeated mentid_array = split (repeated mentid, "| ")
DepartmentName_count = ubound (departmentName_array)
I = 0
Response. Write ("<script language = 'javascript '>" & chr (13 ))
Response. Write ("<! -- // "& Chr (13 ))
Response. Write ("var subcat = new Array ();" & chr (13 ))
For x = 1 to departmentName_count step 1
Set teacherRs = server. CreateObject ("adodb. recordset ")
TeacherSql = "select * from [t_account] where [department] =" & departmentID_array (x) & "and [WriteOff] = '0' and [ID] <> 1 order by [realname] asc"
TeacherRs. open teacherSql, conn, 1, 1
Do while not teacherRs. eof
Response. write ("subcat [" & I & "] = new Array ('" & departmentID_array (x) & "', '" & teacherRs ("realname ") & "(" & teacherRs ("username") & ") ','" & teacherRs ("ID") & "')" & chr (13 ))
TeacherRs. movenext
I = I + 1
Loop
Set teacherRs = nothing
Next
Response. Write ("// -->" & chr (13 ))
Response. Write ("</script>" & chr (13 ))
Copy the content to the clipboard code:
<Script language = "JavaScript">
<! --
Function changeselect1 (locationid)
{
Document. class_info2.teacher.length = 0; // clear the data from the initialization drop-down list
Document. class_info2.teacher.options [0] = new Option ('--- Select instructor ---', ''); // give the first value
For (I = 0; I <subcat. length; I ++)
{
If (subcat [I] [0] = locationid)
{Document. class_info2.teacher.options [document. class_info2.teacher.length] = new Option (subcat [I] [1], subcat [I] [2]);}
}
}
// -->
Function check2 ()
{
If (document. class_info2.teacher.value = "")
{
Window. alert ("select a teacher !!! ");
Return false;
}
If (document. class_info2.subject.value = "")
{
Window. alert ("select a course !!! ");
Return false;
}
}
</Script>
Copy the content to the clipboard code:

<! -- // For the form name, see the preceding JS Code. // -->
<Select name = "department" onChange = "changeselect1 (this. value)">
<Option> --- Select a department --- </option>
<% For k = 1 to departmentName_count step 1%>
<Option value = "<% = inclumentid_array (k) %>"> <% = departmentName_array (k) %> </option>
<% Next %>
</Select>
& Nbsp;
<Select name = "teacher">
<Option> --- Select a instructor. --- </option>
</Select>

Related Article

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.