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

How to write the correct syntax of javascript setinterval_Basic knowledge

WBOY
Release: 2016-05-16 16:43:56
Original
1021 people have browsed it

A few days ago, I wrote a small program using setinterval. I won’t explain what this setinterval is used for.

The method written can be used in other browsers. Later, when colleagues in the testing team tested it, something went wrong. Because they love to use 360 ​​and IE. I couldn't figure it out for two days. IE always reported that the parameters of the method were wrong, and then it reported that the method could not be found. Finally, I found the problem!

But I really want to express my dissatisfaction strongly. The problem is that people copy too much from the Internet, which leads to many mistakes in the copying, such as

Copy code The code is as follows:

setInterval(QuoteList('parameter'),3000);

There is even
Copy code The code is as follows:

setInterval(QuoteList,3000,'parameter ');

I have to mention the fault tolerance performance of major browsers, especially Firefox, Maxthon, etc. For such error scripts, they actually know that you are wrong, but they can understand you. means, so there is nothing wrong with running it. But IE doesn't! ! It doesn’t recognize it at all!

Because the correct way to write it is:
Copy the code The code is as follows:

setInterval("QuoteList('parameter')",3000);

This problem has bothered me for several days. I always thought it was a browser compatibility issue!
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