ASP下拉菜单事件

来源:百度知道 编辑:UC知道 时间:2024/05/23 18:21:53
有2个数据库.

第一个数据库里的数据为:
id name
1 abcd
2 bcde
3 deab

第二个数据库

id id2 name
1 1 1234
2 1 12345
3 2 123456
4 2 145456
5 3 78946

做两个下拉菜单,
第一个下拉菜单内容是第一个数据库的,当选择id为1时,第二个下拉菜单的内容只显示第二个数据库中id2为1的内容.
用onchange 事件
希望得到尽量详细的代码!

这是我做的部门和职位连动的菜单,是适当修改就可以使用了。
PositionSelect 选框的名称,创建的会员,默认值
你可以吧创建的会员参数去掉,调用你的数据库就可以了。
'部门职位联动菜单
Sub PositionSelect(ByVal SelectName, ByVal CreaterID, ByVal DefautValue)
Dim arrDefaultValue, arrDepartment, arrPosition
Dim i, j, DepartmentID, defDepartment, defPosition
DepartmentID = 0
defDepartment = 0
defPosition = 0
arrDefaultValue = ls.Execute("select DepartmentID, PositionID from Positions where PositionID = " & DefautValue)
If not IsArray(arrDefaultValue) Then
Redim arrDefaultValue(1,0)
arrDefaultValue(0,0) = 0
arrDefaultValue(1,0) = 0
End If
arrDepartment = ls.Execute("select distinct d.DepartmentID, d.DepartmentName, d.ListOrder from Departments d with(nolock) inner join Positions p with(nolock) on d.DepartmentID = p.DepartmentID where d.MemberID = " & CreaterID & " order by d.ListOrder asc, d.DepartmentID asc")
If IsArray(arrDepartment) Then<