| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 767 人关注过本帖
标题:求助啊,如何在下面的代码中,加入倒计时??????????????
取消只看楼主 加入收藏
abc3425
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-9-5
收藏
 问题点数:0 回复次数:0 
求助啊,如何在下面的代码中,加入倒计时??????????????
<!--#include file="inc/char.asp" -->
<!--#include file="inc/conn.asp" -->
<!--#include file="stu_examSession.asp"-->
<script language="javascript" src="js/stuExam.js" type="text/javascript"></script>
<%
dim startTime, endTime
startTime=Time()

dim sql,rs,action
'lastPaperID    刚才的题号
'paperID        当前的题号
dim stuId,stuName,examID,lastPaperID,paperID

'已经作答和总数
dim isDone,noDone,isDoneT,noDoneT,totalID

action=trim(request("action"))
examID=cint(session("examID"))
stuId=session("stuId")
stuName=session("stuName")
paperID=trim(request("paperID"))

'判断考卷状态
sql="select stuStatus from stuScore where examID="&examID&" and stuID='"&stuId&"'"
set rs=conn.execute(sql)
if not(rs.bof or rs.eof) then
    if rs("stuStatus")="over" then
        response.Redirect("stu_examOver.asp?action=showScore")
    elseif rs("stuStatus")="locked" then
        call stuExamLogout()
        response.Write "您已经被监考教师锁定,暂时不能作答!"
        response.End()
    end if
else
    call stuExamLogout()
    response.Write "考卷不存在!"
    response.End()
end if

'更新在线状态
sql="update stuScore set stuStatus='online' where examID="&examID&" and stuID='"&stuId&"'"
set rs=conn.execute(sql)

'检查当前试题号
if paperID="" then
    paperID=1
else
    paperID=cint(paperID)
end if

if action = "updatePaper" then
    lastPaperID=trim(request("lastPaperID"))
    call updatePaper(stuId,lastPaperID,examID)
end if

'查出已经答题数目、试卷总题数
sql="SELECT count(*) as isDone FROM stuPaper where quizStatus<>0 and stuid='"&stuId&"' and examID="&examID
set rs=conn.execute(sql)
isDone=rs("isDone")

sql="SELECT count(*) as rsCount FROM stuPaper INNER JOIN quizLib ON stuPaper.quizID = quizLib.ID where stuid='"&stuId&"' and examID="&examID
set rs=conn.execute(sql)
totalID=rs("rsCount")

noDone=totalID-isDone

'写出答题的连接
sql="select * from stuPaper where examID="&examID&" and stuID='"&stuId&"' order by paperID asc"
set rsPaper=conn.execute(sql)
while not(rsPaper.bof or rsPaper.eof)
    if rsPaper("quizStatus")=true then
        isDoneT=isDoneT+"<a href=stu_examPaper.asp?action=list&paperID="&rsPaper("paperID")&" target=mainFrame>"&rsPaper("paperID")&"</a>. "
    else
        noDoneT=noDoneT+"<a href=stu_examPaper.asp?action=list&paperID="&rsPaper("paperID")&" target=mainFrame>"&rsPaper("paperID")&"</a>. "
    end if
    rsPaper.movenext
wend

call list(stuId,paperID,examID)

'保存考生答案
function updatePaper(stuId,lastPaperID,examID)
    sql="update stuPaper set stuKey='"&replace(replace(request("stuKey"),",","")," ","")&"', quizStatus=-1 where stuid='"&stuId&"' and examID="&examID&" and paperID="&lastPaperID
    set rs=conn.execute(sql)
end function

'显示考卷试题
function list(stuId,paperID,examID)
    if paperID>=totalID then
        lastPaperID=paperID
        paperID=paperID
    else
        lastPaperID=paperID
        paperID=paperID+1
    end if
    sql="SELECT stuPaper.*,quizLib.quizTitle,quizLib.quizOption FROM stuPaper INNER JOIN quizLib ON stuPaper.quizID = quizLib.ID where stuid='"&stuId&"' and paperID="&lastPaperID&" and examID="&examID
    set rs=conn.execute(sql)

    dim quizClass,quizOption
    quizClass=rs("quizClass")
%>
<link href="test.css" rel="stylesheet" type="text/css" />

<form name="form1" method="post" action="?action=updatePaper&lastPaperID=<%=lastPaperID%>&paperID=<%=paperID%>">
  <table width="100%" border="1">
    <tr align="center">
      <th colspan="2">学号:<%=stuId %> , 姓名:<%=stuName%> -- 当前题号:<%= lastPaperID %></th>
    </tr>
    <tr>
      <td width="20%" align="right" nowrap>本题题型:</td>
      <td>
        <%
    select case quizClass
        case "radio1"
            response.Write("判断题")
        case "radio2"
            response.Write("单选题")
        case "checkbox"
            response.Write("多选题")
        case "text"
            response.Write("填空题")
    end select
    %>
      </td>
    </tr>
    <tr>
      <td align="right">题干:</td>
      <td style="font:bold;"><%=(rs("quizTitle"))%> </td>
    </tr>
    <%if quizClass<>"text" then%>
    <tr>
      <td align="right">选择项:</td>
      <td>
        <%
    if quizClass="radio1" then
        response.Write "<input name='stuKey' type='radio' value='A'>正确<br><input name='stuKey' type='radio' value='B'>错误"
    else
        if quizClass="radio2" then quizClass="radio"
        quizOption=split(rs("quizOption"),"|")
        for i=0 to ubound(quizOption)
            response.Write "<input name=stuKey type="&quizClass&" value="&chr(i+65)&">"&chr(i+65)&":"&(quizOption(i))&"<br>"
        next
    end if
      %>
      </td>
    </tr>
    <%else%>
    <tr>
      <td align="right" nowrap>试题答案:</td>
      <td><input name="stuKey" type="text" class="inputTextLong" id="stuKey" value=<%=rs("stuKey")%>></td>
    </tr>
    <%end if%>
    <tr>
      <td align="right" nowrap>您的答案:</td>
      <td>&nbsp;<%=rs("stuKey")%></td>
    </tr>
    <tr>
      <td align="right">&nbsp;</td>
      <td><input name="Submit" type="submit" class="inputButton" onClick="return checkForm(this.form)" value="提交答案">
        <input name="Submit2" type="reset" class="inputButton" value="重置答案"></td>
    </tr>
    <tr>
      <td align="right">答题信息:</td>
      <td>已答题数:<%= isDone &"/"&totalID %><br>
        已答:<%= isDoneT %><br> <font color="#FF0000">未答:<%= noDoneT %> </font>
      </td>
    </tr>
    <tr>
      <td align="right">&nbsp;</td>
      <td><a href="stu_examOver.asp?action=examover" target="_parent">交卷(有2次确认机会)</a></td>
    </tr>
  </table>
</form>
<%
end function

function stuExamLogout()
    'session("stuExamlgOk")=false
    'session("examID")=0
    'session("stuId")=""
    session.Contents.RemoveAll()
end function

endTime=Time()
response.Write "<br/>运行时间:" & FormatNumber((endtime-startime)*1000,3) & "毫秒"
%>
搜索更多相关主题的帖子: 倒计时 代码 
2008-09-05 20:29
快速回复:求助啊,如何在下面的代码中,加入倒计时?????????????? ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031259 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved