用ASP制作在线测试
2001-02-21 10:58:56 来源:WEB开发网核心提示:<%CurQ = Request.Form("CurQ")Answ = Request.Form("Answ")correct=Request.Form("Correct")wrong=Request.Form("Wrong")
<%
CurQ = Request.Form("CurQ")
Answ = Request.Form("Answ")
correct=Request.Form("Correct")
wrong=Request.Form("Wrong")
'Poor Man's IsNull Code goes here
If PoorMansIsNull(CurQ) Then
CurQ = 1
correct = 0
wrong = 0
End If
If PoorMansIsNUll(Answ) Then
CurQ = CurQ + 1
If CurQ > (Your maximum number of questions) Then
%>
<p>Congratulations. You have completed this test. You missed <%=wrong%>
questions,
but got <%=correct%> questions right. That is equivilent to a
<%=(correct/(max#ofQs)%>%.
Thank you for doing the test.
<% End If %>
<% set conntemp = server.createobject("adoDB.Connection")
set myDSN = '(your DSN info goes here)
conntemp.Open myDSN
set MySQL = "SELECT * FROM QUESTIONS WHERE QuestionID=" & CurQ
set rsTemp= conntemp.Execute(mySQL)
%>
<h2>Question Number <%=rsTemp("QuestionID")%> </h2>
<form method=POST action="myasp.ASP">
<input type=hidden name=CurQ value=<%=CurQ%>>
Your question is <%=rsTemp("Question")%><br>
Answer:
<select name="AnsW">
<option value=1><%=rsTemp("AnswerA")</option>
<option value=2><%=rsTemp("AnswerB")</option>
<option value=3><%=rsTemp("AnswerC")</option>
<option value=4><%=rsTemp("AnswerD")</option>
</select>
<input type=hidden value="<%=correct%>"><input type=hidden value="<%=wrong%>">
<input type=reset value="Clear the Form"><input type=submit value="OK!">
</form>
<% Else %>
<% set conntemp = server.createobject("adoDB.Connection")
set myDSN = '(your DSN info goes here)
conntemp.Open myDSN
set mySQL = "SELECT * FROM QUESTIONS WHERE QuestionID=" & CurQ
set rsTemp= conntemp.Execute(mySQL)
If AnsW = rsTemp("CorrectAns") Then
%>
<p>Congratulations. You got it right. Whee</p>
<% correct = correct + 1 %>
<% Else %>
<p>I'm sorry, you missed the question. You can review by
reading: </p>
<p><%=rsTemp("reference")</p>
<% wrong = wrong + 1 %>
<% End If %>
<form method=POST action="myASP.ASP">
<input type="hidden" name=curQ value="<%=curQ%>">
<input type="hidden" name=correct value="<%=correct%>">
<input type="hidden" name=wrong value="<%=wrong%>">
<input type="submit" value="Next Question"%>
</form>
<% End If %>
CurQ = Request.Form("CurQ")
Answ = Request.Form("Answ")
correct=Request.Form("Correct")
wrong=Request.Form("Wrong")
'Poor Man's IsNull Code goes here
If PoorMansIsNull(CurQ) Then
CurQ = 1
correct = 0
wrong = 0
End If
If PoorMansIsNUll(Answ) Then
CurQ = CurQ + 1
If CurQ > (Your maximum number of questions) Then
%>
<p>Congratulations. You have completed this test. You missed <%=wrong%>
questions,
but got <%=correct%> questions right. That is equivilent to a
<%=(correct/(max#ofQs)%>%.
Thank you for doing the test.
<% End If %>
<% set conntemp = server.createobject("adoDB.Connection")
set myDSN = '(your DSN info goes here)
conntemp.Open myDSN
set MySQL = "SELECT * FROM QUESTIONS WHERE QuestionID=" & CurQ
set rsTemp= conntemp.Execute(mySQL)
%>
<h2>Question Number <%=rsTemp("QuestionID")%> </h2>
<form method=POST action="myasp.ASP">
<input type=hidden name=CurQ value=<%=CurQ%>>
Your question is <%=rsTemp("Question")%><br>
Answer:
<select name="AnsW">
<option value=1><%=rsTemp("AnswerA")</option>
<option value=2><%=rsTemp("AnswerB")</option>
<option value=3><%=rsTemp("AnswerC")</option>
<option value=4><%=rsTemp("AnswerD")</option>
</select>
<input type=hidden value="<%=correct%>"><input type=hidden value="<%=wrong%>">
<input type=reset value="Clear the Form"><input type=submit value="OK!">
</form>
<% Else %>
<% set conntemp = server.createobject("adoDB.Connection")
set myDSN = '(your DSN info goes here)
conntemp.Open myDSN
set mySQL = "SELECT * FROM QUESTIONS WHERE QuestionID=" & CurQ
set rsTemp= conntemp.Execute(mySQL)
If AnsW = rsTemp("CorrectAns") Then
%>
<p>Congratulations. You got it right. Whee</p>
<% correct = correct + 1 %>
<% Else %>
<p>I'm sorry, you missed the question. You can review by
reading: </p>
<p><%=rsTemp("reference")</p>
<% wrong = wrong + 1 %>
<% End If %>
<form method=POST action="myASP.ASP">
<input type="hidden" name=curQ value="<%=curQ%>">
<input type="hidden" name=correct value="<%=correct%>">
<input type="hidden" name=wrong value="<%=wrong%>">
<input type="submit" value="Next Question"%>
</form>
<% End If %>
- ››asp.net页面弄成伪静态页面
- ››Asp.net 中将汉字转换成拼音的方法
- ››ASP.NET及JS中的cookie基本用法
- ››ASP.NET获取MS SQL Server安装实例
- ››asp.net实现调用百度pai 在线翻译英文转中文
- ››ASP.NET页面选项进行提示判断
- ››Asp.net定时执行程序
- ››ASP.NET中利用DataList实现图片无缝滚动
- ››ASP.NET验证控件RequiredFieldValidator
- ››ASP.NET中使用System.Net.Mail发邮件
- ››ASP.NET中获取用户控件中控件的ID
- ››ASP.NET中FileBytes写成文件并存档
更多精彩
赞助商链接