gusucode.com > ASP+ACCESS在线考试系统设计(源代码+论文) > ASP+ACCESS在线考试系统设计(源代码+论文)\郭晓璇论文第二稿\test\testindex.asp

    <%
Session.TimeOut=200
response.expires=0
dim shjian 
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" &Server.MapPath("../试题库.mdb")
set rs=server.createobject("adodb.recordset")
set rs.activeconnection=conn
tab1=session("tab")
sql="select * from 试卷名称表 where 试卷名称='"& tab1 & "'"
Set rs =conn.Execute(sql)

if not rs.eof then
     sj=rs("时间")
end if


rs.close
%>
<script language="vbscript">

dim timerID 
dim timerRunning 
dim time1
dim now_time
dim ss_time
dim remanent_time
dim shjian 
shjian=<%=sj%>
timeRunning = false
ss_time=0
k=0
function AutoSubmit()
	count1.classname="text1"
	count2.classname="text1"
	count3.classname="text1"
	count4.classname="text1"
	count5.classname="text1"
	if timerRunning then
		clearTimeout(timerID)
	end if
	timerRunning = false
	remanent_time=shjian
	StarAuto()
end function

function StarAuto()
	if k mod 4=0 then
		if ss_time=0 then
			ss_time=59
			remanent_time=remanent_time-1
			now_time =timeserial(0,remanent_time,0)
		else
				ss_time=ss_time-1
		end if
		time1=formatdatetime(now_time,4)
		if ss_time<10 then
			time1=cstr(time1)&":0"&ss_time
		else
			time1=cstr(time1)&":"&ss_time
		end if
	end if
	clock.innerHTML = time1
	timerRunning = true
	if cdate(time1)>#00:10:30# then
		timerID = setTimeout("starauto()",1000)
	elseif cdate(time1)>#00:10:00# then
		if k mod 2=0 then
					clock.style.color = "red"
					clock.style.backgroundColor = "#3299cc"
		else 
					clock.style.color = "white"
					clock.style.backgroundColor = "#3299cc"
		end if
		window.status="考试剩余10分钟,请注意抓紧时间"
		timerID = setTimeout("starauto()",250)
	elseif cdate(time1)>#00:00:00# then
		window.status=""
		timerID = setTimeout("starauto()",1000)
        else
               window.status="考试结束!"
               window.Parent.frames("main").form1.submit()
  'form1.submit()
	end if	
end function

function save_onclick()
	if window.Parent.frames("main").document.title="考核系统" then
		window.Parent.frames("main").frmform.rest_time.value=remanent_time
		window.Parent.frames("main").frmForm.submit()
	end if
end function

function posit_scroll(posit)
if window.Parent.frames("main").document.title="考核系统" then
	window.parent.frames("main").document.all.item(posit).scrollintoview(true)
	window.parent.frames("main").warning.style.visibility = "visible"
end if
end function

function posit_scroll2()
	if window.event.srcElement.className="text1" then
		posit=window.event.srcElement.innerHTML 
		window.parent.frames("main").document.all.item(posit).scrollintoview(true)
	end if
end function

function change_color()
	if window.event.srcElement.classname ="text1" then
		window.event.srcElement.style.color="red"
	end if
end function

function restore_color()
	if window.event.srcElement.classname="text1" then
		window.event.srcElement.style.color="white"
	end if
end function
</script>

<html>
<head>
<title>试卷</title>
<base target="main">
</head>

<body bgcolor="#b8bcff" onload="AutoSubmit()">
<%userip=request.ServerVariables("Remote_ADDR")%>

<table border="0" width="100%">
  <tr>
    <td width="100%" align="center"></td>
  </tr>
  <tr>
    <td width="100%" align="center"></td>
  </tr>
</table>
<div align="center"><center>

<table border="0" width="100%">
  <tr>
    <td width="100%" align="center"><font color="#FF0000" face="宋体"><strong>剩余时间</strong></font></td>
  </tr>
</table>
</center></div><div align="center"><center>

<table border="0" width="100%">
  <tr>
    <td><div id="clock" align="center"><p align="center"> </p>
    </div></td>
  </tr>
  <tr>
    <td></td>
  </tr>
</table>
</center></div><div align="center"><center>

<table width="113" border="1" cellspacing="0" cellpadding="0" bordercolorlight="#FFFF00" bordercolordark="#FFFF00" style="border-collapse: collapse" bordercolor="#111111">
  <tr>
    <th width="118"><font color="#0000FF"><a href="randommain.asp#单项选择题">单项选择题</a></font></th>
  </tr>
  <tr>
    <th width="118"><font color="#0000FF"><a href="randommain.asp#多项选择题">多项选择题</a></font></th>
  </tr>
  <tr>
    <th width="120"><font color="#0000FF"><a href="randommain.asp#判断题">判断题</a></font></th>
  </tr>
  <tr>
    <th width="118"><font color="#0000FF"><a href="randommain.asp#排序题">排序题</a></font></th>
  </tr>
</table>
</center></div>

<table border="0" width="100%">
  <tr>
    <th width="100%"></th>
  </tr>
  <tr>
    <th width="100%"> </th>
  </tr>
  <tr>
    <th width="100%"></th>
  </tr>
  <tr>
    <th width="100%"><form method="POST" action="--WEBBOT-SELF--">
      <!--webbot bot="SaveResults"
      u-file="C:\Inetpub\jin\EXAM\_private\form_results.txt" s-format="TEXT/CSV"
      s-label-fields="TRUE" --><p>
       </p>
      <p> </p>
    </form>
    </th>
  </tr>
  <tr>
    <th width="100%"><p> </th>
  </tr>
  <tr>
    <th width="100%"></th>
  </tr>
</table>
<font face="隶书" style="font-size:22px"><div id="count1" onclick="posit_scroll2()"
onmouseover="change_color()" onmouseout="restore_color()">

<p align="left"> </p>
</div><div id="count2" onclick="posit_scroll2()" onmouseover="change_color()"
onmouseout="restore_color()">

<p> </p>
</div><div id="count3" onclick="posit_scroll2()" onmouseover="change_color()"
onmouseout="restore_color()">

<p> </p>
</div><div id="count4" onclick="posit_scroll2()" onmouseover="change_color()"
onmouseout="restore_color()">

<p> </p>
</div><div id="count5" onclick="posit_scroll2()" onmouseover="change_color()"
onmouseout="restore_color()">

<p> </p>
</div></font>
</body>
</html>