What is the delay statement in javascript

藏色散人
Release: 2021-11-03 15:21:01
Original
1987 people have browsed it

The delay statement of javascript is "setTimeout(function() { remind(); }, 5000);" or "setInterval(function() { remind() }, 5000);".

What is the delay statement in javascript

The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.

What is the delay statement in javascript?

JavaScript delay function

1.setTimeout function

setTimeout(function() { remind(); }, 5000);  //5秒后将会调用执行remind()函数
Copy after login

2.setInterval function

var interval;
interval = setInterval(function() { remind() }, 5000);  //5秒循环调用执行remind()函数
clearInterval(interval);   //清除延时程序
Copy after login

3.Discover An example of

var timer;
if (login.state !== undefined) {
    if (login.state) {
        var fen = login.info.fen;
        var xianbey = login.info.xianBey
        clearTimeout(timer);    //清除延时程序
    }
}
else {
    timer = setTimeout(arguments.callee, 1);    //延时循环执行自己
}
Copy after login

[Recommended learning: javascript basic tutorial]

The above is the detailed content of What is the delay statement in javascript. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!