📄 student_view_test.asp
字号:
<html>
<head>
<% help_location = "take_test" %>
<!-- Author: Brad Pierce -->
<title>Student Take a Test</title>
<link href="../student/student_basics.css" rel="stylesheet" type="text/css">
<table border='0'><tr><td><img src="../images/student_netest.gif"></td><td width='5%'></td><td width='100%'><br><h2>Take a Test</h2></td></tr>
<!-- #include file="../student_navbar/student_navbar_print.inc" -->
<%
If NOT Session("student_authenticated") Then
Response.Redirect("student_login.asp")
End If
%>
</head>
<TD valign='top'><br>
<%
dim oConn ' Connection Object
dim oRS ' Record Set Object
Set oConn=Server.CreateObject("ADODB.connection")
set oRS=Server.CreateObject("ADODB.recordset")
oConn.Open "DSN=sd2db; UserID=Admin; pwd=netest"
session("selected_test") = request("selected_test")
sqltext = "SELECT Test_Name, Test_Instructions FROM Test WHERE Test_Code=" & session("selected_test") & ""
oRS.Open sqltext, oConn
response.write "<h3><font color='#043566'>" & oRS("Test_Name") & "</font></h3>"
response.write "<h3><u>Test Instructions</u></h3>"
response.write "<table border='1'><tr><td>" & oRS("Test_Instructions") & "</td></tr></table>"
oRS.Close
sqltext = "SELECT * FROM Question WHERE Test_Code=" & session("selected_test") & " ORDER BY Question_Number"
oRS.Open sqltext, oConn
session("mc_count") = 0
session("tf_count") = 0
session("mtf_count") = 0
session("match_count") = 0
session("comp_count") = 0
session("sa_count") = 0
session("essay_count") = 0
Response.Write "<FORM METHOD='post' ACTION='student_submit_test.asp'>"
DO WHILE NOT oRS.EOF
SELECT CASE oRS("Question_Type_Code")
'------------------------
' display multiple choice
'------------------------
CASE "MC"
IF NOT mc_previous_print THEN
Response.Write "<BR><H3><U>Multiple Choice</U></H3>"
response.write "<table border='1'>"
END IF
Response.Write "<tr><td valign='top'><b>" & oRS("Question_Number") & ". </b></td>"
' display delimited question
question = oRS("Question_Ask")
FoundPos = instr(question, "|")
Response.Write "<td>" & Left(question, FoundPos - 1) & "  </td>" & _
"<td valign='top'>  <SELECT NAME='mc_answer_" & oRS("Question_Number") & "' SIZE='1'>" & _
"<OPTION SELECTED VALUE='null'>Choose an answer"
'diplay choices in an option box
choices_counter = 1
DO WHILE FoundPos < len(question)
NextPos = InStr(FoundPos + 1, question, "|")
IF NextPos THEN
Response.Write "<OPTION VALUE='" & chr(64 + choices_counter) & "'><b>" & chr(64 + choices_counter) & ". </b>" & Mid(question, FoundPos + 1, NextPos - FoundPos - 1)
ELSE
Response.Write "<OPTION VALUE='" & chr(64 + choices_counter) & "'><b>" & chr(64 + choices_counter) & ". </b>" & Right(question, len(question) - FoundPos)
FoundPos = len(question)
EXIT DO
END IF
FoundPos = NextPos
choices_counter = choices_counter + 1
LOOP
Response.Write "</SELECT></td></tr>"
session("mc_count") = session("mc_count") + 1
mc_previous_print = TRUE
'-------------------
' display true/false
'-------------------
CASE "TF"
IF NOT tf_previous_print THEN
IF session("mc_count") THEN
response.write "</table><br>"
END IF
Response.Write "<BR><H3><U>True/False</U></H3><table border='1'>"
END IF
Response.Write "<tr><td>" & _
"<b>" & oRS("Question_Number") & ".</b> " & _
"<INPUT TYPE='RADIO' NAME='tf_answer_" & oRS("Question_Number") & "' " & "VALUE='TRUE'>True " & _
"<INPUT TYPE='RADIO' NAME='tf_answer_" & oRS("Question_Number") & "' " & "VALUE='FALSE'>False" & _
"</TD>" & "<TD>  " & _
oRS("Question_Ask") & _
"</TD></TR>"
session("tf_count") = session("tf_count") + 1
tf_previous_print = TRUE
'----------------------------
' display modified true/false
'----------------------------
CASE "MTF"
IF NOT mtf_previous_print THEN
IF session("mc_count") OR session("tf_count") THEN
response.write "</table><br>"
END IF
Response.Write "<H3><U>Modified True/False</U></H3>"
Response.Write "<B>The key word is <U>underlined</U> after the question. If your answer is false," & "<br>" & _
"specify the correction to the keyword in the space provided.</B><br><br>"
response.write "<table border='1'>"
END IF
' display delimited question and keyword
question = oRS("Question_Ask")
FoundPos = instr(question, "|")
Response.Write "<TR><TD><b>" & oRS("Question_Number") & ".</b></td>" & _
"<td>" & "<INPUT TYPE='RADIO' NAME='mtf_answer_" & oRS("Question_Number") & "'" & " VALUE='TRUE'>True " & _
"<INPUT TYPE='RADIO' NAME='mtf_answer_" & oRS("Question_Number") & "'" & " VALUE='FALSE'>False" & " " & _
"<INPUT NAME='mtf_correction_" & oRS("Question_Number") & "'" & " SIZE='15'>" & _
"</TD><td>" & Left(question, FoundPos - 1) & "</td>" & _
"<td>  <u>" & Right(question, Len(question) - FoundPos) & "</u></TD>" & _
"</TR>"
session("mtf_count") = session("mtf_count") + 1
mtf_previous_print = TRUE
'-----------------
' display matching
'-----------------
CASE "MATCH"
IF NOT match_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") THEN
response.write "</table><br>"
END IF
Response.Write "<BR><H3><U>Matching</U></FONT></H3>"
response.write "<table border='1'>"
Response.Write "<td></td><td width='40%'><U>Questions</U></td><td><U>Correct Answer</U></td><td><U>Possible Answers</U></td></tr>"
END IF
Response.Write "<tr><td><b>" & oRS("Question_Number") & ". </b></td>"
' display delimited match list and answer box
match_list = oRS("Question_Ask")
FoundPos = instr(match_list, "|")
Response.Write "<td width=200>" & Left(match_list, FoundPos - 1) & "</td>"
Response.Write "<td width=125 valign='top' align='center'>" & "<INPUT SIZE=2 id=text1 name='match_answer_" & oRS("Question_Number") & "'>" & " </td>"
'display possible answers
Response.Write "<td valign='top' align='left'><b>" & chr(65 + session("match_count")) & ". </b>" & Right(match_list, Len(match_list) - FoundPos) & _
"</td></tr>"
session("match_count") = session("match_count") + 1
match_previous_print = TRUE
'-------------------
' display completion
'-------------------
CASE "COMP"
IF NOT comp_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") OR session("match_count") THEN
response.write "</table><br>"
END IF
Response.Write "<BR><H3><U>Completion</U></H3>"
response.write "<table border='1'>"
END IF
Response.Write "<tr>" & _
"<td valign='top'><b>" & oRS("Question_Number") & ".</b></td><td>  " & oRS("Question_Ask") & "</td><td valign='top'>" & _
"  <input name='comp_answer_" & oRS("Question_Number") & "' type='text' size='15'>" & _
"</td></tr>"
session("comp_count") = session("comp_count") + 1
comp_previous_print = TRUE
'---------------------
' display short answer
'---------------------
CASE "SA"
IF NOT sa_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") OR session("match_count") OR session("comp_count") THEN
response.write "</table><br>"
END IF
Response.Write "<BR><H3><U>Short Answer</U></H3>"
response.write "<table border='1'>"
END IF
Response.Write "<tr><td valign='top'><b>" & _
oRS("Question_Number") & ".</b></td><td>  " & oRS("Question_Ask") & "</td><td valign='top'>  " & _
"<INPUT TYPE='text' WIDTH='43' NAME='sa_answer_" & oRS("Question_Number") & "'>" & _
"</td></tr>"
session("sa_count") = session("sa_count") + 1
sa_previous_print = TRUE
'--------------
' display essay
'--------------
CASE "ESSAY"
IF NOT essay_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") OR session("match_count") OR session("comp_count") OR session("sa_count") THEN
response.write "</table><br>"
END IF
Response.Write "<BR><H3><U>Essay</U></H3><BR>"
response.write "<table border='1'>"
END IF
Response.Write "<tr><td valign='top'><b>" & oRS("Question_Number") & ".</b></td><td>  " & oRS("Question_Ask") & "</td></tr>" & _
"<tr><td></td><td><TEXTAREA NAME='essay_answer_" & oRS("Question_Number") & "'" & " ROWS='3' COLS='50'></TEXTAREA></td></tr>"
session("essay_count") = session("essay_count") + 1
essay_previous_print = TRUE
CASE ELSE
Response.Write "FATAL ERROR...INCORRECT QUESTION_TYPE_CODE"
END SELECT
oRS.MoveNext
LOOP
' check for a test without any questions
IF session("mc_count") OR session("tf_count") OR session("mtf_count") OR session("match_count") OR session("comp_count") OR session("sa_count") OR session("essay_count") THEN
Response.Write "</table>"
END IF
'Submit and Reset Buttons
Response.write "<br><br><b><img src='../images/warning.gif'>Before you submit, check over the test to make sure you are satisfied with your answers.<br>"
Response.Write "    You cannot retake the test after it has been submitted for grading.</b>"
Response.Write "<p><input type='submit' value='Submit Test' id='submit'1 name='submit'1>"
%>
</td></tr>
<tr><td></td><td colspan='2'><br><br><hr size='2' color='#000000'>
<font size='1'>Powered by Netest</font>
</td></tr></table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -