js中setTimeout与clearTimeout

开启定时器

var timer1=window.SetInterval(要执行的代码,毫秒数)

var timer2=window.SetTimeout(要执行的代码,毫秒数)

关闭定时器

clearInterval(timer1)

clearTimeout(timer2)

原文地址:https://www.cnblogs.com/codebyzw007/p/2586085.html