I need to call a function that updates some JS objects on the page every 2 minutes. How would I do that?
I created a onload function and a countdown function that refreshes a whole page and therefore resets the timer until next page refresh, but this is not the way I want it. Is there a way to keep an infinite time loop?
I assume, if I could create a an infinite loop and do something like this:
if (currentSeconds%120==0){
callFunction();
}
setInterval(callFunction, 120000);
阅读https://developer.mozilla.org/en-US/docs/DOM/window.setInterval和https://developer.mozilla.org/en-US/docs/DOM/window.setTimeout
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.