标签:
1 <%@ page language="java" import="java.util.*" pageEncoding="gbk"%> 2 <%@ taglib prefix="s" uri="/struts-tags"%> 3 <html> 4 <head> 5 <title>开始考试</title> 6 <link href="student/images/css2.css" rel="stylesheet" type="text/css"/> 7 <style type="text/css"> 8 <!-- 9 .STYLE3 {font-size: 18px; } 10 .STYLE4 {font-size: 18px; font-weight: bold; } 11 .STYLE5 {color: #FF0000} 12 --> 13 </style> 14 <script type="text/javascript"> 15 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> 70 </head> 71 72 <body onload="sT()"> 73 <table width="1003" height="485" border="0" cellpadding="0" cellspacing="0" class="centerbg"> 74 <tr> 75 <td width="149" height="485"> </td> 76 <td width="741" valign="top" class="rightbian"> 77 <form action="submitExam.action" method="post"> 78 <table width="98%" border="0" align="center" cellpadding="0" cellspacing="10"> 79 <tr> 80 <td><div align="center" class="STYLE3">考试时间:60 分钟</div></td> 81 <td><div align="center" class="STYLE3">考生:${sessionScope.student.name}</div></td> 82 <td><div align="center" class="STYLE3">总分 :100 分</div></td> 83 </tr> 84 <tr> 85 <td> </td> 86 <td><div id="tTime"></div></td> 87 <td> </td> 88 </tr> 89 <tr> 90 <td colspan="3" bgcolor="#999999" class="STYLE4">选择题(每小题5分,共10个)</td> 91 </tr> 92 <!--题目开始--> 93 94 <s:iterator value="#request.ChoiceQuestion" var="cq" status="sta"> 95 <tr> 96 <td colspan="3"><strong>第<span class="STYLE5">${sta.index + 1}</span>题 ${cq.c_question}</strong> </td> 97 </tr> 98 <tr> 99 <td colspan="3"><strong>A.</strong>${cq.c_choiceA}</td> 100 </tr> 101 <tr> 102 <td colspan="3"><strong>B.</strong>${cq.c_choiceB}</td> 103 </tr> 104 <tr> 105 <td colspan="3"><strong>C.</strong>${cq.c_choiceC}</td> 106 </tr> 107 <tr> 108 <td colspan="3"><strong>D.</strong>${cq.c_choiceD}</td> 109 </tr> 110 <tr> 111 <td height="32" colspan="3" bgcolor="#CCCCCC">选择答案: 112 <input type="hidden" name="c_answer1${sta.index}" value="${cq.c_answer}"/> 113 <input type="radio" name="c_answer${sta.index}" value="A" checked="checked"/> 114 A 115 <input type="radio" name="c_answer${sta.index}" value="B" /> 116 B 117 <input type="radio" name="c_answer${sta.index}" value="C" /> 118 C 119 <input type="radio" name="c_answer${sta.index}" value="D" /> 120 D</td> 121 </tr> 122 </s:iterator> 123 <tr> 124 <td colspan="3" bgcolor="#999999" class="STYLE4">填空题(每小题5分,共10个)</td> 125 </tr> 126 <s:iterator value="#request.FillQuestion" var="fq" status="stf"> 127 <tr> 128 <td colspan="3"><strong>第<span class="STYLE5">${stf.index + 11}</span>题 ${fq.f_question}</strong> </td> 129 </tr> <tr> 130 <td height="32" colspan="3" bgcolor="#CCCCCC">输入答案: 131 <input type="hidden" name="f_answer1${stf.index}" value="${fq.f_answer}"/> 132 <input type="text" name="f_answer${stf.index}" size="40"/></td> 133 </tr> 134 </s:iterator> 135 <!--题目结束--> 136 <tr> 137 <td colspan="3"><div align="center"> 138 <input type="submit" value=" 提交答卷 " name="Submit" /> 139 </div></td> 140 </tr> 141 </table> 142 </form> 143 </td> 144 <td width="113"> </td> 145 </tr> 146 </table> 147 </body> 148 </html>
标签:
原文地址:http://www.cnblogs.com/zzzzw/p/4853545.html