Home >Web Front-end >JS Tutorial >Js setInterval and setTimeout (timing execution and loop execution) code (parameters can be passed in)_javascript skills

Js setInterval and setTimeout (timing execution and loop execution) code (parameters can be passed in)_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:25:121317browse

Document's own methods:
Loop execution: var timeid = window.setInterval ("Method name or method", "Delay"); window.clearInterval(timeid);
Timing execution: var tmid = window. setTimeout("Method name or method", "Delay"); window.clearTimeout(tmid);
Example:
A. When no parameters are required in the method to be executed

Copy code The code is as follows:



B. When parameters are required in the method to be executed
Copy code The code is as follows:


Statement:
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