jquery文件
jquery.plugin.min.js
jquery.countdown.min.js
$(function () {
/*********************Master Timer*************************/
$('#defaultCountdown').countdown({
until: +'@ViewBag.timeMast',
onExpiry: liftOff,
expiryText: '<div class="over">Sorry! Time Out</div>',
expiryUrl: '/stude/exam/completedexam?id=' + '@ViewBag.ID',
onTick: highlightLast5,
compact: true,
layout: ' <span> </span>Time Remaining :<span> </span> <b> {hnn}{sep}{mnn}{sep}{snn}</b> '
});
function liftOff() {
CallMessage("Sorry Time Out", " Closed", "orangered");
}
function highlightLast5(periods) {
$('#currentTime').val($.countdown.periodsToSeconds(periods));
if ($.countdown.periodsToSeconds(periods) === 300) {
CallMessage("Last five minutes remaining", "Hurry up", "green");
$(this).addClass('highlight');
}
$('#monitor').text('Just ' + periods[5] + ' minutes and ' +
periods[6] + ' seconds to go');
}
});
我将上述计时器用于在线检查系统,它对于所有其他计时器均正常工作,但唯一的问题是我无法重置计时器没有页面加载
Q1)如何使用jquery或ajax从数据库中获取下一个值来在最后5秒之前重置计时器?
Q2)对我来说,还有其他定时器插件比这对帮助重置定时器更好吗?
预先感谢