Solution to JSsetTimeout function incompatibility failure and non-execution in Firefox _ javascript skills

Source: Internet
Author: User
Today, I checked my website background logon Detection Using JQuery + AJAX + PHP. The compatibility in other browsers is good. As a result, the JS built-in function setTimeout in FireFox is not executed, this article provides detailed solutions. Today, I checked my website background logon Detection Using JQuery + AJAX + PHP. After I found that my login was successful, I executed the page Jump function section JavaScript (JS) code effects can be executed well in IE and Google Chrome, And the compatibility is good. As a result, the JS built-in function setTimeout in FireFox is not executed. It is invalid and no error is reported! Open FireBUG and expect it to detect JS errors. The result is useless... the compatibility of Javascript (JS) script code in various browsers is a headache. After some debugging and searching, finally, the error of running and executing the setTimeout JS Code in Firefox is solved. Currently, this setTimeout is compatible with IE6, 9, Google Chrome, FireFox, Apple Safari, and Opera.

SetTimeout is a very good function, which is often used by front-end engineers on the website pages in a few seconds. SetTimeout: The JS built-in function is also easy to use. The following describes the setTimeout () function and its usage and examples and sample code:

SetTimeout () is used to specify how many milliseconds a JS function or expression code will be executed
SetTimeout usage, syntax, and parameter: setTimeout (code, millisec)
SetTimeout parameter description:
Code is a required parameter. The JavaScript code string to be executed after the function to be called.
Millisec is a required parameter. The number of milliseconds to wait before executing the code. The conversion between milliseconds and seconds is: 1000 milliseconds = 1 second
SetTimeout instance Code (the page jumps to the specified URL in 1 second ):

The Code is as follows:


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.