js定时操作

参考

function func(){console.log("print")} //定时任务
var interval = setInterval(func, 2000); //启动,func不能使用括号
clearInterval(interval );//停止
interval = setInterval(func, 2000); //重新启动即可

 

posted @ 2020-04-24 21:50  lvlin241  阅读(139)  评论(0编辑  收藏  举报