Implement a function _javascript technique based on JavaScript to implement a certain time

Source: Internet
Author: User

In the actual need may need to specify after the specified time to perform a function to achieve the desired purpose, which is a timer effect, just in the JS has been given such a function settimeout (), the following first introduced the second function of the

Usage:

Grammar:

Copy Code code as follows:

SetTimeout (Code,interval)

This function can specify that a specified code is executed after the specified event, and that the code executes only once.

The settimeout () function has two parameters, the first parameter sets the execution code to execute, and the second parameter sets how long it takes to execute the code, in milliseconds.

Code instance:

<! DOCTYPE html>
 
 

The above code can specify that a dialog box will pop up after 5 seconds, using the settimeout () function to run the Tishi () function after 5 seconds.

The above content is based on JavaScript to implement a certain time to perform a function of the relevant knowledge, interested friends to study together.

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.