87,907
社区成员
发帖
与我相关
我的任务
分享
_obj.timeCounter = (function() {
var total = examTimeLength*60; // 单位秒
return function(elemId) {
obj = document.getElementById(elemId);
var s = (total % 60) < 10 ? ('0' + total % 60) : total % 60;
var h = total / 3600 < 10 ? ('0' + parseInt(total / 3600))
: parseInt(total / 3600);
var m = (total - h * 3600) / 60 < 10 ? ('0' + parseInt((total - h * 3600) / 60))
: parseInt((total - h * 3600) / 60);
obj.innerHTML = h + ' : ' + m + ' : ' + s;
total--;
timerConverse = setTimeout("T.timeCounter('" + elemId + "')", 1000);
window.name = total;
if (total < 0){
clearTimeout(timerConverse);
alert('考试时间已到!您无法继续答卷,点击确定后提交试卷。');
T.resultDetailSave(true);
}
}
})();
<#if !isView>
<div class="myexa-timer" style="top:104px;right:60px;">
<p id="timeCounter" style="font-size:18px;"></p>
<button type="button" class="myexa-timer-btn">查看考试进度</button>
</div>
</#if>
_obj.timeCounter = (function() {
var total = parseInt(window.name, 10); // 单位秒
if (!total || total<=0)
total = examTimeLength*60; // 单位秒
return function(elemId) {
obj = document.getElementById(elemId);
var s = (total % 60) < 10 ? ('0' + total % 60) : total % 60;
var h = total / 3600 < 10 ? ('0' + parseInt(total / 3600))
: parseInt(total / 3600);
var m = (total - h * 3600) / 60 < 10 ? ('0' + parseInt((total - h * 3600) / 60))
: parseInt((total - h * 3600) / 60);
obj.innerHTML = h + ' : ' + m + ' : ' + s;
total--;
timerConverse = setTimeout("T.timeCounter('" + elemId + "')", 1000);
window.name = total;
if (total < 0){
clearTimeout(timerConverse);
alert('考试时间已到!您无法继续答卷,点击确定后提交试卷。');
T.resultDetailSave(true);
}
}
})();