setTimeout

setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式。

语法:  setTimeout(code,millisec)

 

 

setInterval 定时触发

用法:timerID = setInterval(codeStr, milliSeconds);

  • timerID 是 setInterval 的返回值,返回定时器的 ID,当然也可以不要返回值。
  • codeStr 是要执行的代码。
  • milliSeconds 是触发的间隔时间,单位为毫秒。

 

 

clearInterval 取消定时器

用法:clearInterval(timerID);

timerID 就是 setInterval 的返回值。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2021-05-20
  • 2022-02-17
  • 2021-08-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-04
  • 2022-01-12
  • 2021-08-24
  • 2021-07-03
  • 2022-12-23
  • 2022-03-04
  • 2021-11-06
相关资源
相似解决方案