与考试相关的JS方法

var IsChange = 0;
var ensure = 0; var timeCounter = (function () {//考试剩余时间 倒计时
var int;
//var total = 3600;//1小时
var ExamTime = $("[id$='hid_ExamTime']").val();//考试时间 分钟
//alert(ExamTime);
var total = ExamTime * ;
return function (elemID) {
obj = document.getElementById(elemID);
var s = (total % ) < ? ('' + total % ) : total % ;//时
var h = total / < ? ('' + parseInt(total / )) : parseInt(total / );//分
var m = (total - h * ) / < ? ('' + parseInt((total - h * ) / )) : parseInt((total - h * ) / );//秒
obj.innerHTML = '剩余时间 ' + h + ' : ' + m + ' : ' + s;
total--;
int = setTimeout("timeCounter('" + elemID + "')", );
if (total < -) {
clearTimeout(int);
if (window.confirm('考试时间结束,请确认交卷')) {
//PostAnswer();
}
}
}
})()

调用这个JS方法

function Load() {
timeCounter('timeCounter'); //设置页面自动保存
//setTimeout("btnSave()", 10);
}

提交答案

 function PostAnswer() {
try {
ensure = ;
$("[id$='btnSubmitExam']").click();//触发提交按钮事件
//alert(111); }
catch (err) { alert(err); }
}

答完的题目,答题卡切换颜色

function ChangeStatus(Guid) {//改变右侧题目栏题目状态,做完的题目增加 finished 样式
try {
IsChange = ; $("#AnswerSheet ul li").each(function () {
//alert($(this).attr("ID"));
if ($(this).attr("ID") == Guid) {
//alert($(this).attr("ID"));
$(this).addClass('finished');
}
})
}
catch (error) {
alert('题目切换颜色Js出错,具体错误:' + error);
}
}
//防止复制和粘贴

            document.oncontextmenu = new Function("event.returnValue=false");
document.onselectstart = new Function("event.returnValue=false");

考试时间还没有结束,提前交卷

function SubmitAnswer() {
if (window.confirm('考试结束时间还没有到,你确定要交卷?')) {
PostAnswer();
}
}
上一篇:异常处理_Maven之web项目java.lang.LinkageError


下一篇:Android数据存储(一)----SharedPreferences详解