JavaScript学习笔记之定时器_基础知识

WBOY
Release: 2016-05-16 16:18:35
Original
1002 people have browsed it

定时器1

  用以指定在一段特定的时间后执行某段程序。

  setTimeout():

  格式:[定时器对象名=] setTimeout(“”,毫秒)

  功能:执行一次。

  例子:

复制代码代码如下:




timer1.html










定时器2

  以一定的时间为间隔,不断地重复执行表达式。

  setInterval():

  格式:[定时器对象名=] setInterval(“”,毫秒)

  功能:重复执行,直至窗口、框架被关闭或执行clearInterval。

  clearInterval():

  格式:clearInterval(定时器对象名)  

  功能:终止定时器

  例子:

复制代码代码如下:




timer2.html







0



以上就是本文的全部内容了,希望大家能够喜欢

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!