📄 test.asp
字号:
<body leftmargin="100">
<%
dim conn,connstr
connstr="Driver={sql server};UID=sa;PWD=sa;database=zikao;server=BILLGATES"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs2=Server.CreateObject("ADODB.Recordset")
sql="select * from course"
rs2.open sql,conn
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
CountLinkAction = 0
do while not rs2.eof
%>
subcat[<%=CountLinkAction%>] = new Array("<%= trim(rs2(1))%>","<%= trim(rs2(0))%>");
<%
CountLinkAction = CountLinkAction + 1
rs2.movenext
loop
rs2.close
set rs2=nothing
%>
onecount=<%=CountLinkAction%>;
function changelocation(locationid)
{
document.form1.Dcname.length = 0;
var locationid=locationid;
var i;
document.form1.Dcname.options[0] = new Option('选择课程','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.Dcname.options[document.form1.Dcname.length] = new Option(subcat[i][0], subcat[i][0]);
}
}
}
</script>
<FORM id=form1 name=form1 action=testpost.asp method=post>
<table border="1" width="445" height="407">
<tr>
<td height="35" width="435" colspan="2">
<p align="center"><b><font size="7">考试登记</font></b></td>
</tr>
<tr>
<td height="32" width="104">
<p align="right">学生学号:</td>
<td height="32" width="325"><input type="text" name="sno" size="20"></td>
</tr>
<tr>
<td height="27" width="104">
<p align="right">课程编号:</td>
<td height="27" width="325"><select size="1" name="Dcno"onChange="changelocation(document.form1.Dcno.options[document.form1.Dcno.selectedIndex].value)">
<%
set rs=Server.CreateObject("ADODB.Recordset")
rs.open sql,conn
if not rs.eof then
rs.MoveFirst()
while not rs.eof
response.write "<option value="&rs(0)&">"&rs(0)&"</option>"
rs.MoveNext()
wend
end if
rs.close
set rs=nothing
%></select>
</td>
</tr>
<tr>
<td height="27" width="104">
<p align="right">课程名称:</td>
<td height="27" width="325"><select size="1" name="Dcname">
</select>
</td>
</tr>
<tr>
<td height="35" width="104">
<p align="right">考试时间:</td>
<td height="35" width="325"><input name="stime" type="text" id="stime" size="20"></td>
</tr>
<tr>
<td height="177" width="435" colspan="2">
<p align="center"><input type="submit" value="提交" name="B3">
<input type="reset" value="重置" name="B4"></td>
</tr>
</table>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -