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