Home > Web Front-end > JS Tutorial > body text

JavaScript study notes: timer_basic knowledge

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

Timer 1

Used to specify a program to be executed after a specific period of time.

setTimeout():

Format: [timer object name=] setTimeout(“”, milliseconds)

Function: Execute once.

Example:

Copy code The code is as follows:




timer1.html










Timer 2

Continuously execute the expression repeatedly at certain intervals.

setInterval():

Format: [timer object name=] setInterval(“”, milliseconds)

Function: Repeat until the window or frame is closed or clearInterval is executed.

clearInterval():

Format: clearInterval (timer object name)

Function: Terminate timer

Example:

Copy code The code is as follows:




timer2.html







0



The above is the entire content of this article, I hope you all like it

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template