当前位置: 移动技术网 > IT编程>开发语言>.net > 用ASP制作在线测试

用ASP制作在线测试

2019年01月12日  | 移动技术网IT编程  | 我要评论

使徒行者下载,华中师范大学,卖点商情

<%

curq = request.form("curq")
answ = request.form("answ")
correct=request.form("correct")
wrong=request.form("wrong")

poor mans 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(和php搭配之最佳组合) = "select * from questions where questionid=" & curq
    set rstemp= conntemp.execute(mysql(和php搭配之最佳组合))
%>

<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(和php搭配之最佳组合) = "select * from questions where questionid=" & curq

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网