ASP.NET中的计时器实现 [英] timer implementation in asp.net
本文介绍了ASP.NET中的计时器实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
如何在在线考试系统中实现计时器.
Hi!
How can I implement a timer in an online examination system.
Thanks!
推荐答案
您可以使用Timer控件.
看看这些:
JavaScript计时器 [ Ajax计时器控件 [ Ajax计时器控件-2 [ MSDN:计时器控件概述 [
You can use Timer control for it.
Look at these:
Javascript timers[^]
Ajax Timer control[^]
Ajax Timer control - 2[^]
MSDN: Timer Control Overview[^]
计时器也可以在ClientSide上使用以下命令代码:
Timer can also be used at ClientSide using the following Code:
var _timer;
function StartTimer() {
if (_timer == null) {
var timeInterval = document.getElementById("hdnTimeInterval").value;
var timeValue = document.getElementById(timeInterval).value;
if (timeValue != null || timeValue != undefined) {
_timer = window.setInterval(EndTimer, timeValue);
}
}
}
function EndTimer() {
if (_timer != null) {
window.clearInterval(_timer);
_timer = null;
}
}
hdnTimeInterval-将是您的时间间隔(以毫秒为单位)
window.setInterval-用于在达到设置的时间间隔时调用函数.
在上述情况下,我调用了EndTimer函数来结束计时器.
希望这对您有所帮助.
hdnTimeInterval - will be your time interval in milliseconds
window.setInterval - Is used to call a function on reaching the set time interval.
In the above case I have called EndTimer function to end the timer.
Hope this will be useful.
DaniWeb文章为您提供了很好的参考. http://www.daniweb.com/web-development/aspnet/threads/39568/asp.net-timer-control [ ^ ]
DaniWeb article is a good reference for you. http://www.daniweb.com/web-development/aspnet/threads/39568/asp.net-timer-control[^]
这篇关于ASP.NET中的计时器实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文