javascript--scripting language

Source: Internet
Author: User

First, JavaScript basic syntax.

(a) Data type and variable type. Integer, Decimal, Layout, string, datetime, array cast: parseint () parsefloat () IsNaN ()

(b) array var array name = new Array ([length]); "Counterfeit" array a.length-length a[subscript] = value. a[Subscript]

(c) function

Function name (formal parameter)

{

}

function Showstr (a)

{

}

Second, Dom operation
Dom-document the object Model document. Tree
Linear model, tree-shaped model, mesh model
Window
History
Location
Document

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

The verb of the noun behavior of the object--object characteristic

(i) window 1.alert () Window.alert ();

2.[var a =]window.confirm ("Can you run over the leopard?"  "); Prompt (); --infrequently used, no need to remember, input

3.open (); Open ("Address", "_blank/_self", "new Window Features"); [var a =]window.open ("http://www.sina.com.cn"); Open the page in a new window and return to the new window. A is also a variable of window type. Detailed translation required.

4.close (); Window.close ();

5.setTimeout ("code", milliseconds) after the specified number of milliseconds, execute code once.

Example

<Scriptlanguage= "JavaScript">functionShowTime () {varDate= NewDate (); document.getElementById ("hh"). InnerHTML=date; Window.settimeout ("showTime ()", +); }window.settimeout ("showTime ()", +);</Script>

Practice
Make a page that appears in 5 seconds after Sina homepage

<Scriptlanguage= "JavaScript">varA;functionOpenad () {a=window.open ("http://www.sina.com.cn","_blank","width=200 height=200 toolbar=no top=0 left=0"); Window.settimeout ("Closead ()", the);}functionClosead () {a.close ();} Window.settimeout ("Openad ()", the);</Script>

javascript--scripting language

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.