·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 用ASP制作在线测试

用ASP制作在线测试

类别: ASP教程  评论数:0 总得分:0
<%

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 %>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1