开发者

Need multiple independent timers in Ajax

I need the ability to create up to N amount timers in JavaScript/Ajax that will count like a stopwatch(but have no buttons).

Another issue is that my data will be loaded via another Ajax request so the page will c开发者_StackOverflowonstantly be updating. I'm not sure how I would be able to keep a timer's correct value when that happens.

Thanks!


Javascript already has this functionality. Checkout the

setInterval
setTimeout

functions. Both will let you say "In x number of milliseconds, I want the following callback function to fire". With setTimeout, the callback fires once. With setInterval, the callback fires repeatedly until you tell it to stop.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜