请教asp 高手!!!!

crazyrain 2003-05-08 12:03:27
三个表:(p主键 f外键)
系别表:
表名:departcode
字段:departid(p)
字段:departname
专业表:
字段:specialid(p)
字段:departid(f)
字段:specialname
班级表:classcode
字段:classid(p)
字段:specialid(f)
字段:classname

看看以下程序那里又问题呀?选择了系别后,专业里面出现相应的专业,系别里面要求是已经选择的系,班级相同.
<form action="studentAdd.asp?flag=new" method="post" onsubmit="return checkform()" name="formTmp">
<tr class=trhead>
<td width="50%" colspan="4">添加学生:</td>
</tr>
<tr class=trmid>
<td width="20%">系别:</td>
<td width="50%" colspan="2">
<select name="departid" onchange=window.location.href="studentAdd.asp?departid="+formTmp.departid.options[selectedIndex].value+"">
<option value="" >选择系别</option>
<%
set rs1=server.createobject("adodb.recordset")
sql="select * from departcode"
rs1.open sql,conn,1,3,1
while not rs1.eof %>
<option <% selected request.querystring("departid"),rs1("departid")%> value=<%=rs1("departid")%>><%=rs1("departname")%></option>
<% rs1.movenext
wend
rs1.close:set rs1=nothing
%>
</select>
</td>
<td width="30%" rowspan="5"></td>
</tr>
<tr class=trmid>
<td width="20%">所在专业:</td>
<td width="50%" colspan="2">
<select name="specialid"
onchange=window.location.href="studentAdd.asp?departid="+formTmp.departid.options[selectedIndex].value+"&specialid="+formTmp.specialid.options[selectedIndex].value+"">
<option value="" selected>选择专业</option>
<%
'取得数据库专业的临时记录
set rs1=server.createobject("adodb.recordset")
sql="select * from specialcode where departid='"&request.querystring("departid")&"'"
rs1.open sql,conn,1,3,1
while not rs1.eof and not rs1.bof %>
<option <% selected request.querystring("specialid"),rs1("specialid")%> value=<%=rs1("specialid")%>><%=rs1("specialname")%></option>
<%
rs1.movenext
wend
rs1.close :set rs1=nothing
%>
</select>
</td>
</tr>
<tr class=trmid>
<td width="20%">所在班级:</td>
<td width="50%" colspan="2">
<select name="classid" >
<option value="">选择班级</option>
<%
'取得数据库班机的临时记录
set rs1=server.createobject("adodb.recordset")
sql="select * from classcode where specialid='"&request.querystring("specialid")&"'"
rs1.open sql,conn,1,3,1
while not rs1.eof
response.write ("<option value="&rs1("classid")&">"&rs1("classname")&"")
rs1.movenext
wend
rs1.close :set rs1=nothing %>
</select>
</td>
</tr>



<%
'判断是否是已选择函数
function selected(string1,string2)
if string1=string2 then
Response.Write "selected"
end if
end function
%>
...全文
48 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧