function $(id){
return document.getElementById(id)
}
function RunTimer(k){//倒计时
$("tit_time").innerHTML="倒计时: "+k+" 秒"
k = k-1
if(k>=0){
alert(k);
timer=window.setTimeout(function(){RunTimer(k)},1000)
}else{
subFoem()
}
}
function showSub(){//显示对话框
var posX=document.body.offsetWidth ||document.documentElement.offsetWidth
var posY=document.body.offsetHeight ||document.documentElement.offsetHeight
function hidSub(){//隐藏对话框
if ($("sub").style.display="block"){
clearTimeout(timer)
$("sub").style.display="none"
$("sub_bt").disabled=0
}
}
function subFoem(){//提交
hidSub()
document.forms[0].option.value="-3";
form.submit();
}
//-->
function stA() {
document.forms[0].option.value="1";
return true;
}
function stB() {
document.forms[0].option.value="2";
return true;
}
function stC() {
document.forms[0].option.value="3";
return true;
}
function stD() {
document.forms[0].option.value="4";
return true;
}
function stYES() {
document.forms[0].option.value="8";
return true;
}
function stNO() {
document.forms[0].option.value="16";
return true;
}
function stPre() {
document.forms[0].option.value="-1";
return true;
}
function stNext() {
document.forms[0].option.value="-2";
return true;
}
function stRefer() {
showSub();
}
function timeOver() {
alert("考试时间到!");
document.forms[0].option.value="-3";
form.submit();
}
function showLeftTime(stopTimeMillSec) {
var now = new Date();
var nowMillSec = now.getTime();
var today = new Date(stopTimeMillSec - nowMillSec);
if(today < 0 ){
timeOver();
}
var hour = today.getHours() - 8;
var minute = today.getMinutes();
var second = today.getSeconds();
time = hour + ":" + minute + ":" + second;
document.form.lefttime.value = time;
var s = "showLeftTime(" + stopTimeMillSec + ");"
window.setTimeout(s, 500);
}
function Clicked(evt,qid) { //键盘触发事件
var theKey
function $(id){
return document.getElementById(id)
}
function RunTimer(k){//倒计时
$("tit_time").innerHTML="倒计时: "+k+" 秒"
k = k-1
if(k>=0){
alert(k);
timer=window.setTimeout(function(){RunTimer(k)},1000)
}else{
subFoem()
}
}
function showSub(){//显示对话框
var posX=document.body.offsetWidth ||document.documentElement.offsetWidth
var posY=document.body.offsetHeight ||document.documentElement.offsetHeight
function hidSub(){//隐藏对话框
if ($("sub").style.display="block"){
clearTimeout(timer)
$("sub").style.display="none"
$("sub_bt").disabled=0
}
}
function subFoem(){//提交
hidSub()
document.forms[0].option.value="-3";
form.submit();
}
//-->
function stA() {
document.forms[0].option.value="1";
return true;
}
function stB() {
document.forms[0].option.value="2";
return true;
}
function stC() {
document.forms[0].option.value="3";
return true;
}
function stD() {
document.forms[0].option.value="4";
return true;
}
function stYES() {
document.forms[0].option.value="8";
return true;
}
function stNO() {
document.forms[0].option.value="16";
return true;
}
function stPre() {
document.forms[0].option.value="-1";
return true;
}
function stNext() {
document.forms[0].option.value="-2";
return true;
}
function stRefer() {
showSub();
}
function timeOver() {
alert("考试时间到!");
document.forms[0].option.value="-3";
form.submit();
}
function showLeftTime(stopTimeMillSec) {
var now = new Date();
var nowMillSec = now.getTime();
var today = new Date(stopTimeMillSec - nowMillSec);
if(today < 0 ){
timeOver();
}
var hour = today.getHours() - 8;
var minute = today.getMinutes();
var second = today.getSeconds();
time = hour + ":" + minute + ":" + second;
document.form.lefttime.value = time;
var s = "showLeftTime(" + stopTimeMillSec + ");"
window.setTimeout(s, 500);
}
case 101: //上一题 5 号键
stPre();
form.submit();
break
case 102: //下一题 6键
stNext();
form.submit();
break
case 99: //C 3 键
stC();
form.submit();
break
case 96: //D 0键
stD();
form.submit();
break
case 97: //A 1键
stA();
form.submit();
break
case 98: //B 2键
stB();
form.submit();
break
case 100: //交卷 4键
stRefer();
form.submit();
break
case 109: //关机 双击-键
GuanJi()
break
default:
break
}
}
if(qid==1){ //判断题
switch(theKey){
case 101: //上一题 5 号键
stPre();
form.submit();
break
case 102: //下一题 6键
stNext();
form.submit();
break
case 97: //对 1键
stYES();
form.submit();
break
case 98: //错 2键
stNO();
form.submit();
break
case 100: //交卷 4键
stRefer();
form.submit();
break
case 109: //关机 双击-键
GuanJi()
break
default:
break
}
}
}
function GuanJi(){
var flag = form3.hid_flag.value;
var front_time = form3.hid_time.value;
var date = new Date();
var wkey = window.event.keyCode
if(wkey == 109 && flag == 1){
form3.hid_flag.value=2;
time = Date.parse(date);
form3.hid_time.value=time;
var tid = setTimeout("fun()",100);
function fun(){
if(tid != null){clearTimeout(tid);tid=null;}
///...处理一步的操作
if(需要继续) tid = setTimeout("fun()",100);
}