JavaScricp, javascri

Source: Internet
Author: User

JavaScricp, javascri

JavaScript syntax

The basic data type is basically the same as that of C #. The omnipotent variable var can store other types of values and can be directly used.

Explicit conversion:

Parseint () -- convert to an integer

Parsefloat () -- convert to decimal

Operator: Same as C #

Mathematical operators: +-*/% + + --;

Relational OPERATOR: =! ==>=<=;

Logical OPERATOR: & | !;

Other operators: + =-= * =/= % =? :

Branch statement:

If... else

Loop statement:

For ()

Array:

New Array (); -- fixed type, Unfixed Length

Array attribute: a. length; number of array elements

 

JavaScript is a scripting language

Common Dialog Box:

  • Alert () -- warning dialog box to pop up a warning dialog box
  • Confirm () -- returns True or false with the OK or cancel buttons
  • Prompt () -- a dialog box that can be entered is displayed.

 

 

Function:

Function Name (parameter ){}

Function () {}-- anonymous function

Window object:

  • Window. open ("open URL" "open Location ")
  • Window. opener -- open the previous page on this page
  • Window. close () -- close the current page
  • Window. navigate ("url") -- hyperlink Function
  • Window. moveTo (x, y) -- move the browser to a certain position
  • Window. resizeTo (x, y) -- set the width and height of the browser
  • Window. scrollTo (x, y) -- anchor Function

Timer:

  • Window. setTimeout (function () {}, interval of execution time) -- how long will it be executed? only once
  • Window. setInterval (function () {}, interval execution time) -- The interval at which execution is performed and does not stop

Window. history:

  • Window. history. back () -- return the page
  • Window. history. forward () -- page forward
  • Window. history. go (n) -- forward and backward. If n is positive, the system advances to n pages. If n is negative, the system returns to n pages.
  • Window. location. href = "url" -- hyperlink, mainly
  • Window. status -- objects in the toolbar at the bottom of the Operation page

Window.doc ument:

  • Docunment. getElementById ("id"); locate by id. You can find one at most;
  • Docunment. getElementsByName ("name"); find the array by name;
  • Docunment. getElementsByTagName ("name"); find the Tag name and find the array;
  • Docunment. getElementsByClassName ("name") is searched based on classname and an array is found;

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.