<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>开始考试</title>
<link href="student/images/css2.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
<!--
.STYLE3 {font-size: 18px; }
.STYLE4 {font-size: 18px; font-weight: bold; }
.STYLE5 {color: #FF0000}
-->
</style>
<script type="text/javascript">
1 var ksTime; //定义考试时间以分钟计算
16 ksTime = 60;//设置时间 这里设置为0.1代表是6秒,测试用
17 if(readCookie("ss")=="")
18 {
19 setCookie("ss",new Date(),ksTime/60);
20 }
21 function sT()
22 {
23 var tti = new Date();
24 var lt = parseInt((tti-new Date(readCookie("ss")))/1000)
25 if((ksTime*60-lt)<0)
26 {
27 setCookie("ss",new Date(),0);
28 alert("考试时间到!\n即将提交试卷!");
29 document.forms[0].submit();
30 }
31 else
32 {
33 lm = Math.floor(lt / 60);
34 ls = lt % 60;
35 allY = ksTime*60-lt;
36 ym = Math.floor(allY / 60);
37 ys = allY % 60;
38 document.getElementById("tTime").innerHTML = "考试已经开始了" + lm + "分" + ls + "秒" + ",剩余" + ym + "分" + ys + "秒";
39 var ttt = setTimeout("sT()",1000);
40 }
41 }
42 function readCookie(name)
43 {
44 var cookieValue = "";
45 var search = name + "=";
46 if(document.cookie.length > 0)
47 {
48 offset = document.cookie.indexOf(search);
49 if (offset != -1)
50 {
51 offset += search.length;
52 end = document.cookie.indexOf(";", offset);
53 if (end == -1)
54 end = document.cookie.length;
55 cookieValue = document.cookie.substring(offset, end)
56 }
57 }
58 return cookieValue;
59 }
60 function setCookie(name, value, hours)
61 {
62 var expire = "";
63 if(hours != null) {
64 expire = new Date((new Date()).getTime() + hours * 3600000);
65 expire = "; expires=" + expire.toGMTString();
66 }
67 document.cookie = name + "=" + value + expire;
68 }
69 </script>
</head> <body onload="sT()">
<table width="1003" height="485" border="0" cellpadding="0" cellspacing="0" class="centerbg">
<tr>
<td width="149" height="485"> </td>
<td width="741" valign="top" class="rightbian">
<form action="submitExam.action" method="post">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="10">
<tr>
<td><div align="center" class="STYLE3">考试时间:60 分钟</div></td>
<td><div align="center" class="STYLE3">考生:${sessionScope.student.name}</div></td>
<td><div align="center" class="STYLE3">总分 :100 分</div></td>
</tr>
<tr>
<td> </td>
<td><div id="tTime"></div></td>
<td> </td>
</tr>
<tr>
<td colspan="3" bgcolor="#999999" class="STYLE4">选择题(每小题5分,共10个)</td>
</tr>
<!--题目开始--> <s:iterator value="#request.ChoiceQuestion" var="cq" status="sta">
<tr>
<td colspan="3"><strong>第<span class="STYLE5">${sta.index + 1}</span>题 ${cq.c_question}</strong> </td>
</tr>
<tr>
<td colspan="3"><strong>A.</strong>${cq.c_choiceA}</td>
</tr>
<tr>
<td colspan="3"><strong>B.</strong>${cq.c_choiceB}</td>
</tr>
<tr>
<td colspan="3"><strong>C.</strong>${cq.c_choiceC}</td>
</tr>
<tr>
<td colspan="3"><strong>D.</strong>${cq.c_choiceD}</td>
</tr>
<tr>
<td height="32" colspan="3" bgcolor="#CCCCCC">选择答案:
<input type="hidden" name="c_answer1${sta.index}" value="${cq.c_answer}"/>
<input type="radio" name="c_answer${sta.index}" value="A" checked="checked"/>
A
<input type="radio" name="c_answer${sta.index}" value="B" />
B
<input type="radio" name="c_answer${sta.index}" value="C" />
C
<input type="radio" name="c_answer${sta.index}" value="D" />
D</td>
</tr>
</s:iterator>
<tr>
<td colspan="3" bgcolor="#999999" class="STYLE4">填空题(每小题5分,共10个)</td>
</tr>
<s:iterator value="#request.FillQuestion" var="fq" status="stf">
<tr>
<td colspan="3"><strong>第<span class="STYLE5">${stf.index + 11}</span>题 ${fq.f_question}</strong> </td>
</tr> <tr>
<td height="32" colspan="3" bgcolor="#CCCCCC">输入答案:
<input type="hidden" name="f_answer1${stf.index}" value="${fq.f_answer}"/>
<input type="text" name="f_answer${stf.index}" size="40"/></td>
</tr>
</s:iterator>
<!--题目结束-->
<tr>
<td colspan="3"><div align="center">
<input type="submit" value=" 提交答卷 " name="Submit" />
</div></td>
</tr>
</table>
</form>
</td>
<td width="113"> </td>
</tr>
</table>
</body>
</html>