JavaScript Short Summary 1

Source: Internet
Author: User
Tags setinterval

javascript--script Language Host file NetScape JSScript JS One, JavaScript basic syntax.

(a) Data type and variable type. Data type: integer, Decimal, Layout, string, datetime, array

Variable type: var

Cast: parseint () parsefloat () IsNaN ()

The parseint () usage transforms the input string into an int type. The first letter is not a number, and the result is Nan (not a);

In the middle of the character is not a number, the content after the character will not be resolved, only the preceding content, the string is all numbers, all displayed as int type. Parsefloat () use ibid.

IsNaN () Determines whether it is true.

(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 object Model document objects.

Tree: Linear model, tree model, mesh model window History location document

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

(a) window------The following 1-6 articles will be used frequently

1. Alert () No return value Window.alert ();

2. [var a =]window.confirm ("Can you run over the leopard?")     "); The contents of the brackets are not meaningful, only the confirm () has a return value of true, false when judged

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"); The content inside the brackets doesn't make sense. Opens the page in a new window and returns a new window. A is also a variable of window type. Detailed translation required. Website: http://www.cnblogs.com/xianshui/p/4442699.html

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

5. SetTimeout ("code", number of milliseconds) after the specified number of milliseconds, execute code once.  function ShowTime () {var date = new Date ();  document.getElementById ("hh"). InnerHTML = date;   Window.settimeout ("ShowTime ()", 1000); } window.settimeout ("ShowTime ()", 1000);

Open the page, five seconds after the pop-up ads, and then 5 seconds ads off ************ var A;    function Openad () {a = window.open ("http://www.sina.com.cn", "_blank", "width=200 height=200 toolbar=no top=0 left=0"); Window.settimeout ("Closead ()", 5000); } function Closead () {a.close ();} window.settimeout ("Openad ()", 5000);

6. SetInterval ("code", number of milliseconds) executes code once every specified number of milliseconds.  function ShowTime () {var date = new Date (); document.getElementById ("hh"). InnerHTML = date; } window.setinterval ("ShowTime ()", 1000);

Window.moveto (x, y); Window.resizeto (Width,height); Window.scrollto (x, y);

(ii) historical operation Window.history.go (n)

(iii) Address bar operation Window.location.href//Timed Refresh page function showself () {window.location.href= "untitled-3.html";} Window.setinterval ("Showself ()", 1000);

JavaScript Short Summary 1

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.