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

Example introduction to the difference between interval and setTimeOut in javascript_Basic knowledge

WBOY
Release: 2016-05-16 16:55:30
Original
1013 people have browsed it

setTimeout(code, millisec) //- Execute the code after the specified time

code is required;

millisec is required;

clearTimeout(setTimeoutId) //- Cancel setTimeout()

setInterval(code, millisec); //Loop the execution code within the specified interval milliseconds

code is required;

millisec is required;

clearInterval(intervalId) ;

Use setTimeout(code, millisec) to achieve the setInterval effect, you only need to nest the calling method;

The following is a countdown page

Copy code The code is as follows:





Untitled Document








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