?? test.asp
字號(hào):
<%@ Language=VBScript %>
<% option explicit %><!--#include file="conn.asp"-->
<html>
<head>
<title>考試界面</title>
</head>
<body bgcolor="#FFFFFF" background=images/backimage.gif>
<p align="center"><b><font face="宋體" size="5" color="#FF0000"><%=session("selectsubjectname")%>考試</font></b></p><%if request.form("submit1")="開始考試" then '保存開始時(shí)間 dim starttime
session("starttime")=hour(now())*60+minute(now()) starttime=session("starttime")%><form method="POST" action="result.asp" name="testform">
<table border="0" cellspacing="0" bordercolor="#111111" width="100%" >
<tr>
<td width="100%" height="25"><b><font size="3" color="#000080">一、單項(xiàng)選擇題(每題<%=session("singleper")%>分,共<%=session("singlenumber")%>題)</font></b></td>
</tr>
</table>
<%
dim i,sql,rs,count,temp,strid1,strid2strid1=""strid2=""randomize
for i=1 to session("singlenumber")set rs=server.createobject("adodb.recordset")
sql="select * from question where subjectname='"&session("selectsubjectname") & "'and type='單選題' and haveselect=0 "rs.open sql,conn,3,2
count=rs.recordcount
temp=fix(count*rnd(10))
rs.move temprs("haveselect")=1strid1=strid1 & rs("ID") & ","
%>
<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="100%" cellpadding="0">
<tr>
<td width="100%" bgcolor="#EFEFEF" height="20"> <b><%=i%>、<%=rs("question")%></b></td>
</tr>
<%
if rs("A")<>"" then
%>
<tr>
<td width="100%"> <input type="radio" name="NO<%=rs("id")%>" value="A">A、<%=rs("A")%></td>
</tr>
<%
end if
%> <%
if rs("B")<>"" then
%>
<tr>
<td width="100%"> <input type="radio" name="NO<%=rs("id")%>" value="B">B、<%=rs("B")%></td>
</tr>
<%
end if
%> <%
if rs("C")<>"" then
%>
<tr>
<td width="100%"> <input type="radio" name="NO<%=rs("id")%>" value="C">C、<%=rs("C")%></td>
</tr>
<%
end if
%> <%
if rs("D")<>"" then
%>
<tr>
<td width="100%"> <input type="radio" name="NO<%=rs("id")%>" value="D">D、<%=rs("D")%></td>
</tr> <%
end if
%>
</table>
<% rs.update
next
rs.close
set rs=nothing
%>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber3">
<tr>
<td width="100%" height="25"><b><font color="#000080" size="3">二、多項(xiàng)選擇題(每題<%=session("multiper")%>分,共<%=session("multinumber")%>題。每題至少有1項(xiàng)正確的答案,少選、多選、錯(cuò)選均不得分)</font></b></td>
</tr>
</table>
<%
randomize
for i=1 to session("multinumber")set rs=server.createobject("adodb.recordset")
sql="select * from question where subjectname='"&session("selectsubjectname") & "'and type='多選題' and haveselect=0 "rs.open sql,conn,3,2
count=rs.recordcount
temp=fix(count*rnd(10))
rs.move temprs("haveselect")=1strid2=strid2 & rs("ID") & ","
%>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
<tr>
<td width="100%" bgcolor="#EFEFEF" height="20"> <b><%=i%>、<%=rs("question")%></b></td>
</tr>
<%
if rs("A")<>"" then
%>
<tr>
<td width="100%"> <input type="checkbox" name="NO<%=rs("id")%>" value="A">A、<%=rs("A")%></td>
</tr>
<%
end if
%> <%
if rs("B")<>"" then
%>
<tr>
<td width="100%"> <input type="checkbox" name="NO<%=rs("id")%>" value="B">B、<%=rs("B")%></td>
</tr>
<%
end if
%> <%
if rs("C")<>"" then
%>
<tr>
<td width="100%"> <input type="checkbox" name="NO<%=rs("id")%>" value="C">C、<%=rs("C")%></td>
</tr>
<%
end if
%> <%
if rs("D")<>"" then
%>
<tr>
<td width="100%"> <input type="checkbox" name="NO<%=rs("id")%>" value="D">D、<%=rs("D")%></td>
</tr>
<%
end if
%>
</table>
<% rs.update
next
rs.closeresponse.write("<input type='hidden' name='hidQuestID1' value=" & strID1 & ">")response.write("<input type='hidden' name='hidQuestID2' value=" & strID2 & ">")
set rs=nothingset rs=server.createobject("adodb.recordset")sql="select * from question where haveselect=1 "
rs.open sql,conn,3,2rs.movefirst do while not rs.eof rs("haveselect")=0 rs.update rs.movenext looprs.close
set rs=nothingcall endConnection()'response.write(strid1)'response.write(strid2)%>
<p align=center><input type="submit" value="交卷" name="submit" ></p></form><%dim lefttimelefttime=1do while lefttime>0lefttime=session("testtime")-(hour(now())*60+minute(now())-session("starttime"))
loopif lefttime=0 or lefttime<0 then%><script language=vbscript>
msgbox "時(shí)間到了!請(qǐng)交卷"
</script><%end if%> <% else %> <form method="POST" action="test.asp" name="form"><p align=center><input type="submit" value="開始考試" name="submit1" ></p></form><% response.write "<center>請(qǐng)選擇開始考試!</center>" end if %>
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -