Home > Web Front-end > JS Tutorial > js code executes an instance of a function after delaying a certain period of time

js code executes an instance of a function after delaying a certain period of time

不言
Release: 2018-05-05 16:19:58
Original
2139 people have browsed it

This article mainly introduces examples of js code executing a function after a certain delay. It has certain reference value. Now I share it with you. Friends in need can refer to it

The example is as follows:

 setTimeout(funcName,500);
		
    function funcName() {
      xxxxxx;
    }
Copy after login

Execute funcName() after 0.5 seconds and only execute it once

setInterval(funcName ,5000); Execute funcName() every 5 seconds

Related recommendations:

JS implements dynamically adding events to the label control

The above is the detailed content of js code executes an instance of a function after delaying a certain period of time. For more information, please follow other related articles on the PHP Chinese website!

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