2级下拉列表选择后再显示表中其他联动属性问题

数据库2个表,表名和属性值如下CourseN:C_IDC_NameCourse:CourseIDCourseNameCourseTimeCoursePlaceCourse... 数据库2个表,表名和属性值如下
CourseN: C_ID C_Name

Course: CourseID CourseName CourseTime CoursePlace CourseLeft

-------------------------------
代码如下,想在2级列表中选择CourseName和CourseTime后显示Course表中所关联的CoursePlace 和CourseLeft的值,求具体实现方法,谁能帮下忙,谢谢了

代码如下

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/ConSelCourse.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_ConSelCourse_STRING
Recordset1.Source = "SELECT * FROM CourseN"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
dim id
id=request.QueryString("id")

if id="1" then
response.Write "<br>" & request.Form("lstb")
response.Write "<br>" & request.Form("lsts")
end if

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JS动态列表示例</title>
<script language="javascript">
<!--
var sSort = new Array();
var num = 0;
<%
dim conn,rs,grs,i,j,pstr
pstr=""
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
set grs=server.createobject("adodb.recordset")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.mappath("/SelCourse/SelCourse.mdb")
'写课程JS数组
rs.open "select * from CourseN;",conn,1,1
for i=0 to rs.recordcount-1
pstr=pstr & "<option value=""" & rs("C_Name") & """>" & rs("C_Name") & "</option>"
getsub(rs("C_Name"))
rs.movenext
next

rs.close()
set rs=nothing
set grs=nothing

'根据课程写时间JS数组的过程
sub getsub(pname)
grs.open "select * from Course where CourseName='" & pname & "';",conn,1,1
for j=1 to grs.recordcount
response.write "sSort[num++] = new Array(""" & grs("CourseTime") & """ ,""" & pname & """);" & vbCrlf
grs.movenext
next
grs.close()
end sub
%>

var nsSortCount = num;

function sdbSortChange(cmbsdbSort, cmbsSort)
{
var nSelsdbSort = cmbsdbSort.selectedIndex;
var ssdbSort = cmbsdbSort.options[nSelsdbSort].value;

cmbsSort.length = 0;
cmbsSort.options[0] = new Option('-请选择-', '');
for(var i=0; i<nsSortCount; i++)
{
if(sSort[i][1] == ssdbSort)
{
cmbsSort.options[cmbsSort.length] = new Option(sSort[i][0], sSort[i][0]);
}
}
}

function InitsSort(cmbsdbSort, cmbsSort)
{
var nSelsdbSort = cmbsdbSort.selectedIndex;
var ssdbSort = cmbsdbSort.options[nSelsdbSort].value;
var ssSort = cmbsSort.options[0].value;

cmbsSort.length = 0;
cmbsSort.options[0] = new Option('-请选择-', '');
var n = 0;
for(var i=0; insSortCount; i++)
{
if(sSort[i][1] == ssdbSort)
{
cmbsSort.options[cmbsSort.length] = new Option(sSort[i][0], sSort[i][0]);

if(sSort[i][0] == ssSort)
cmbsSort.options[cmbsSort.length-1].selected = true;
}
}
}

//-->
</script>
</head>
展开
 我来答
jszking1
推荐于2016-04-20
知道答主
回答量:2
采纳率:0%
帮助的人:0
展开全部
剩余代码如下
<body>
<<form action="index.asp?id=1" method="post" name="frmdlist" id="frmdlist">
<table width="408" border="0" align="center" cellpadding="2" cellspacing="2">
<tr>
<td width="400" align="center"> </td>
</tr>
<tr>
<td align="center">选择实验名称
<%response.write "<select name=""lstb"" style=""width:200"" onChange=""sdbSortChange(this,frmdlist.lsts);"">" & pstr & "</select>"%></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center">选择实验时间
<select style="width:200" name="lsts" id="lsts">
</select></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><label></label></td>
</tr>
<tr>
<td align="center"> </td>
</tr>
<tr>
<td align="center"><label></label></td>
</tr>
</table>
<p align="center">
</p>
<p align="center"> </p>
<p align="center">
<input type="submit" name="Submit" value="提交">
</p>
</form>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式