Javascript syntax and timer function _ javascript skills

Source: Internet
Author: User
Beginners may have misunderstandings about the Javascript timers. they think they are threads. In fact, Javascript is running in a single thread, and the timer is only intended to be executed at a certain time in the future, the specific execution time cannot be guaranteed, because in the lifecycle of the page, other code may be in the process of controlling Javascript at different times. 1. basic JavaScript syntax.

(1) data type and variable type. Integer, decimal, layout, string, date and time, forced conversion of array: parseInt () parseFloat () isNaN ()

(2) Array var Array name = new Array ([length]); // "counterfeit" Array a. length-length a [subscript] = value. A [subscript]

(3) functions

The code is as follows:


Function name (parameter)
{
}
Function ShowStr ()
{
}

II. DOM operations
DOM-Document Object Model. Tree
Linear model, tree model, mesh model
Window
History
Location
Document


Head
Body
A, img, table, ul, ol .....
Status

Object-verb of nouns and behaviors characteristic of objects

(1) window 1. alert () window. alert ();

2. [var a =] window. confirm ("Can you run Leopard? He asked "); // prompt (); -- not commonly used, do not remember, input

3. open (); open ("address", "_ blank/_ self", "new window features"); [var a =] window. open ("http://jb51.net"); opens the page in a new window and returns a new window. A is also a window variable. Translation is required for details.

4. close (); window. close ();

5. after setTimeout ("code", milliseconds) is specified, the code is executed once.

Example

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.