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>