📄 test.jsp
字号:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page import="java.util.Date"%>
<%@page import="sys.DB"%>
<%@page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>练习</title>
<script type="text/javascript">
var arry;
function createRequest() {
try {
request = new XMLHttpRequest();
} catch (tryMS) {
try {
request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (otherMS) {
try {
request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (failed) {
request = null;
}
}
}
return request;
}
//得到新的节点列表
function getnode() {
//alert(document.getElementById("chapter").options[document.getElementById("chapter").selectedIndex].value);
request = createRequest();
if (request == null) {
alert("Unable to create request");
return;
}
var url= "getDetails.jsp?type=node&chapter=" +document.getElementById("chapter").options[document.getElementById("chapter").selectedIndex].value;
request.open("GET", url, true);
request.onreadystatechange = displayDetails;
request.send(null);
}
//得到新题
function getquestion(a) {
//alert(document.getElementById("chapter").options[document.getElementById("chapter").selectedIndex].value);
request = createRequest();
if (request == null) {
alert("Unable to create request");
return;
}
//alert(a);
var url= "getDetails.jsp?type=question&id="+a+"&node=" +document.getElementById("node").options[document.getElementById("node").selectedIndex].value;
request.open("GET", url, true);
request.onreadystatechange = displayquestion;
request.send(null);
hideresult();
}
//改变节列表
function displayDetails() {
if (request.readyState == 4) {
if (request.status == 200) {
detailDiv = document.getElementById("anode");
detailDiv.innerHTML = request.responseText;
changevalue2();
}
}
}
//改变题的内容
function displayquestion() {
if (request.readyState == 4) {
if (request.status == 200) {
//alert("afsdfa");
detailDiv = document.getElementById("question");
//alert(request.responseText);
detailDiv.innerHTML = request.responseText;
arry = request.responseText.split("|");
//题干
detailDiv.innerHTML = arry[0];
//alert(arry[1]);
//上一题,下一题按钮
document.getElementById("answer").innerHTML = arry[1];
document.getElementById("help").innerHTML = arry[2];
if(arry[2]=="")
document.getElementById("help").innerHTML = "无";
document.getElementById("pre").innerHTML = arry[3];
document.getElementById("next").innerHTML = arry[4];
document.getElementById("question_index").innerHTML = arry[5];
document.getElementById("showresult").style.display = "";
}
}
}
</script>
<script type="text/javascript">
function changevalue1()
{
getnode();//得到节
hideresult();
}
function changevalue2()
{
getquestion("no");
hideresult();
}
function changevalue3()
{
getquestion(document.getElementById("daohang").options[document.getElementById("daohang").selectedIndex].value);
}
//显示答案
function showresult()
{
document.getElementById("sys_help").style.display = "inline";
document.getElementById("showresult").style.display = "none";
}
//隐藏答案
function hideresult()
{
document.getElementById("sys_help").style.display = "none";
}
function getTimeNow() {
var time = new Date()
var year = time.getYear()
var month = time.getMonth()+1
var day = time.getDate()
var hour = time.getHours()
var minute = time.getMinutes()
var second = time.getSeconds()
document.getElementById("showTime").innerHTML = year+"年"+month+"月"+day+"日 "+hour+":"+minute+":"+second
setTimeout("getTimeNow()",1000)
}
</script>
<style type="text/css">
.s12green{
color:#4f7500;
font-size:12px;
}
.b14green{
color:#4f7500;
font-size:12px;
font-weight:bold;
}
html,body{
width:100%;
height:100%;
margin-top:36px;
padding:0px;
overflow:hidden;
}
#Main{
position:absolute;
top:36px;
left:0px;
width:100%;
height:100%;
overflow:auto;
z-index:1;
}
#ToolBar{
position:absolute;
top:0px;
right:0px;
width:100%;
height:36px;
/*background:#00FFFF;*/
z-index:2;
font-size:18px;
overflow:hidden;
background-image:url(../images/zizhu_02.gif);
}
</style>
</head>
<body onLoad="changevalue1();getTimeNow()">
<div id="ToolBar">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="font-size:12px; font-weight:bold; padding-left:50px; padding-right:30px;">欢迎使用驾校无纸化考试学习系统</td>
<td style="background-image:url(../images/zizhu_04.jpg); width:88px; height:32px; font-size:12px; color:#395500;" align="center" valign="middle">自主学习</td>
<td style="padding-left:50px; color:#cc6600; font-size:12px;">进入自主练习模式,分章节逐题练习</td>
<td style="font-size:12px; color:#645a44; padding-left:100px;" align="right"><div id="showTime"></div></td>
</tr>
</table>
</div>
<div id="Main">
<table align="center" width="1000" border="0" cellspacing="5" cellpadding="0" style="border-bottom:1px; border-left:1px; border-right:1px; border-style:solid; border-color:#e7e7e7; border-top:0px;">
<tr>
<td height="34" colspan="2" class="s12green">
——您正在进行自主学习,在此可进行章节选择 </td>
</tr>
<tr>
<td width="85" height="39" bgcolor="#f5f4f1"><select name="chapter" id="chapter" onChange="changevalue1()">
<%
DB db = new DB();
Connection con = db.getConnection();
ResultSet rs = db.getResultSet("select * from exam_chapter where encode like '%000000'",con);
int j = 1;
while(rs.next())
{
out.print("<option value=\""+rs.getString("encode").trim()+"\">"+"第"+j+"章:"+rs.getString("name").trim()+"</option>");
j ++;
}
%>
</select></td>
<td width="915" bgcolor="#f5f4f1" style="padding-left:8px;"><div id="anode"></div></td>
</tr>
<tr>
<td colspan="2" style="color:#000000; font-size:14px; line-height:22px; padding-top:10px; padding-bottom:10px; padding-left:20px;"><div id="question"></div></td>
</tr>
<tr>
<td height="34" colspan="2" class="s12green">
——请仔细审题,选择您认为正确的选项,点击“查看答案”按钮后可查看正确答案</td>
</tr>
<tr><td colspan="2" align="center"><img src="../images/zizhu_09.gif"></td></tr>
<tr>
<td colspan="2" id="sys_help" style="display:none; line-height:25px; padding-left:20px; padding-top:10px; padding-bottom:10px; background-image:url(../images/zizhu_09.gif); background-position:center; background-position:bottom; background-repeat:no-repeat;">
<span class="b14green">正确答案:</span><span id="answer"></span><br>
<span class="b14green">帮助:</span>
<div id="help" style="font-size:14px; text-indent:2em;"></div> </td>
</tr>
<tr>
<td colspan="2" style="padding-top:10px; padding-bottom:10px;">
<input type="button" id="showresult" onClick="showresult()" value="查看答案">
</td>
</tr>
<tr>
<td colspan="2" height="39" bgcolor="#f5f4f1" align="center">
<span id="pre" style="width:50px;"></span> 第<span id="question_index"></span>题 <span id="next" style="width:50px;"></span>
</td>
</tr>
</table>
<table align="center"><tr><td align="center" style=" font-size:12px; color:#a2a2a2;">Copyright 2008 Harbin Engineering University. Made by: HaoXuefeng, Jeffery Young, DengQinglei, ZhangMeng, LiDan.</td></tr></table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -