实例介绍
【实例简介】
【实例截图】
【核心代码】
<%@ 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>
好例子网口号:伸出你的我的手 — 分享!
网友评论
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明


支持(0) 盖楼(回复)