forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartExam.jsp
More file actions
225 lines (219 loc) · 9.46 KB
/
startExam.jsp
File metadata and controls
225 lines (219 loc) · 9.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*" errorPage="" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<jsp:useBean id="lesson" class="com.wgh.dao.TaoTiDAO" scope="page"/>
<%
int lessonID=Integer.parseInt((String)session.getAttribute("lessonID"));
List list_s=(List)request.getAttribute("singleQue");
int s=40/list_s.size();
List list_m=(List)request.getAttribute("moreQue");
int m=60/list_m.size();
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网络在线考试</title>
<link rel="stylesheet" href="../CSS/style.css"/>
<script language="javascript" src="../JS/AjaxRequest.js">
</script>
<script language="javascript">
timer = window.setInterval("showStartTime();showRemainTime();",1000);
//此处需要加&nocache="+new Date().getTime(),否则将出现时间不自动走动的情况
function showStartTime(){
var loader=new net.AjaxRequest("startExam.do?action=showStartTime&nocache="+new Date().getTime(),deal_s,onerror,"GET");
}
function showRemainTime(){
var loader1=new net.AjaxRequest("startExam.do?action=showRemainTime&nocache="+new Date().getTime(),deal_r,onerror,"GET");
}
function onerror(){
window.open('../index.jsp','','toolbar,menubar,scrollbars,resizable,status,location,directories,copyhistory,height=600,width=778');
window.close();
}
function deal_s(){
showStartTimediv.innerHTML=this.req.responseText;
}
function deal_r(){
showRemainTimediv.innerHTML=this.req.responseText;
if(this.req.responseText=="00:00:00"){
questionsForm.submit.click();
}
}
</script>
<script language=javascript>
function keydown(){
if(event.keyCode==8){
event.keyCode=0;
event.returnValue=false;
alert("当前设置不允许使用退格键");
}if(event.keyCode==13){
event.keyCode=0;
event.returnValue=false;
alert("当前设置不允许使用回车键");
}if(event.keyCode==116){
event.keyCode=0;
event.returnValue=false;
alert("当前设置不允许使用F5刷新键");
}if((event.altKey)&&((window.event.keyCode==37)||(window.event.keyCode==39))){
event.returnValue=false;
alert("当前设置不允许使用Alt+方向键←或方向键→");
}if((event.ctrlKey)&&(event.keyCode==78)){
event.returnValue=false;
alert("当前设置不允许使用Ctrl+n新建IE窗口");
}if((event.shiftKey)&&(event.keyCode==121)){
event.returnValue=false;
alert("当前设置不允许使用shift+F10");
}
}
function click() {
event.returnValue=false;
alert("当前设置不允许使用右键!");
}
document.oncontextmenu=click;
</script>
</head>
<body onLoad="showStartTime();showRemainTime();" onkeydown="keydown()">
<table width="770" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="40" height="39" background="../Images/startExam_leftTop.jpg"> </td>
<td width="667" align="right" background="../Images/startExam_top.jpg">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="23%" nowrap height=23 align=right>考试时间:</td>
<td width="14%" nowrap><font color="#FF0000">20</font>分钟</td>
<td width="13%" nowrap>计 时:</td>
<td width="60" nowrap><div id="showStartTimediv">00:00:00</div>
</td>
<td width="16%" nowrap>剩余时间:</td>
<td width="60" align=left nowrap><div id="showRemainTimediv"></div></td></tr>
</table>
</td>
<td width="19" background="../Images/startExam_top.jpg"> </td>
<td width="44" background="../Images/startExam_rightTop.jpg"> </td>
</tr>
<tr>
<td height="435" rowspan="2" background="../Images/startExam_left.jpg"> </td>
<td height="43" colspan="2"><img src="../Images/startExam_ico.jpg" width="117" height="43"></td>
<td rowspan="2" background="Images/startExam_right.jpg"> </td>
</tr>
<tr>
<td height="600" colspan="2" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" align="center" class="title"><%=lesson.getLesson(lessonID)%> 考试卷
</td>
</tr>
<tr>
<td width="64%"> </td>
<td width="36%"> 满分<font color="red">100</font>分 单选题<font color="red">40</font>分 多选题<font color="red">60</font>分</td>
</tr>
</table>
<html:form action="/manage/startExam.do?action=submitTestPaper" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table id="single" width="90%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td colspan="4" height=23 style="font-size:11pt;">一、单选题(<font color=red>每题<%=s %>分,答错不得分</font>)</td>
</tr>
<logic:iterate id="questions" name="singleQue" type="com.wgh.actionForm.QuestionsForm" scope="request" indexId="ind">
<tr>
<td height=23 colspan="4" align=center nowrap>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8%" align=right height=23>[ ${ind+1} ]</td>
<td width="2%"> </td>
<td width="90%" align=left nowrap style="font-size:11pt;"><bean:write name="questions" property="subject" filter="true"/>
<html:hidden property="idArrS[${ind}]" name="questions"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="A"/></td>
<td width="3%" align=center nowrap>A.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionA" filter="true"/></td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="B"/></td>
<td width="3%" align=center nowrap>B.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionB" filter="true"/></td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="C"/></td>
<td width="3%" align=center nowrap>C.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionC" filter="true"/></td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="D"/></td>
<td width="3%" align=center nowrap>D.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionD" filter="true"/></td>
</tr>
</logic:iterate>
</table>
<table id="single" width="90%" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td colspan="4" height=23 style="font-size:11pt;">二、多选题(<font color=red>每题<%=m%>分,答错不得分</font>)</td>
</tr>
<logic:iterate id="questions" name="moreQue" type="com.wgh.actionForm.QuestionsForm" scope="request" indexId="ind">
<tr>
<td height=23 colspan="4" align=center nowrap>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8%" align=right height=23>[ ${ind+1} ]</td>
<td width="2%"> </td>
<td width="90%" align=left nowrap style="font-size:11pt;"><bean:write name="questions" property="subject" filter="true"/>
<html:hidden property="idArrM[${ind}]" name="questions"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="A"/></td>
<td width="3%" align=center nowrap>A.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionA" filter="true"/></td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="B"/></td>
<td width="3%" align=center nowrap>B.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionB" filter="true"/></td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="C"/></td>
<td width="3%" align=center nowrap>C.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionC" filter="true"/></td>
</tr>
<tr>
<td width="8%" height=23 nowrap> </td>
<td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="D"/></td>
<td width="3%" align=center nowrap>D.</td>
<td width="86%" align=left nowrap><bean:write name="questions" property="optionD" filter="true"/></td>
</tr>
</logic:iterate>
</table>
</td>
</tr>
<tr>
<td align="center"><html:submit property="submit" styleClass="btn_grey" value="交卷"/> </td>
</tr>
</table>
</html:form>
</td>
</tr>
<tr>
<td width="40" height="40" background="../Images/startExam_leftBottom.jpg"> </td>
<td colspan="2" background="../Images/startExam_bottom.jpg"> </td>
<td background="../Images/startExam_rightBottom.jpg"> </td>
</tr>
</table>
</body>
</html>