Definitions and usage of window. setInterval () method and differences between offsetLeft and style. left _ javascript skills

Source: Internet
Author: User
The window. setInterval () method can execute a program according to the specified period. The period is in milliseconds. This article introduces the definition and usage of the window. setInterval () method. If you are interested, refer Definition and usage

The setInterval () method can call functions or computation expressions according to the specified period (in milliseconds.

The setInterval () method does not stop calling the function until clearInterval () is called or the window is closed. The ID value returned by setInterval () can be used as a parameter of the clearInterval () method.

Tip: 1000 milliseconds = 1 second.

Syntax

SetInterval (code, millisec, lang)

Parameters Description
Code Required. The function to be called or the code string to be executed.
Millisec Required. The interval between periodical execution or call codes, in milliseconds.
Lang Optional. JScript | VBScript | JavaScript

Summary:

This method can run a program according to the specified period. The cycle is in milliseconds.

If this method is not disabled or the clearInterval () method is called, it will be executed forever.

The returned value is the unique ID of this method.

To stop the execution of this timer function, see clearInterval () method 1.

Click here to see more properties and methods of window objects.

Browser support:

(1). IE browser supports this method.
(2) Firefox supports this method.
(3) operabrowser supports this method.
(4) chrome supports this method.
(5) The safria browser supports this method.

Code example:

 
 Ant tribe

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.