Home > Web Front-end > JS Tutorial > The difference between javascript setTimeout and setInterval_Basic knowledge

The difference between javascript setTimeout and setInterval_Basic knowledge

WBOY
Release: 2016-05-16 18:39:41
Original
986 people have browsed it

The setTimeout method is a timing program, that is, what to do after a certain time. Pull it down when you're done.
The setInterval method means to repeatedly perform an operation at a certain interval.

If you use setTimeout to implement the function of setInerval, you need to call yourself regularly in the executing program. If you want to clear the counter, you need to call different clearing methods according to the method used:

For example:
tttt=setTimeout('northsnow()',1000);
clearTimeout(tttt);

Or:
tttt=setInterval('northsnow()',1000);
clearInteval(tttt);

For example:

Copy code The code is as follows:






Or:
Copy code The code is as follows:





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