4.21 JavaScript self-learning first-stage review

Source: Internet
Author: User

Javascript is the browser object model. Window and Dom Document Object Model programming is based on objects rather than object-oriented languages. It is a weak internal language and a scripting language for dynamic web page interaction, it is a language that can be interpreted while running. It is top-down. (Event-driven Mode)

The event is as follows:

Onabort: The event triggered when the image loading process is interrupted.

Onblur: triggered when the focus is lost

Onclick: triggered when clicked

Onchange: select the event of the edge

Onfocus: triggered when the focus is obtained.

Onmouesover: When the mouse leaves

Onmouseout: triggered when the mouse passes

Onsubmit: triggered upon submission

OnUnload: triggered when the document is uninstalled

I. Javascript is case-sensitive and has single-line and multi-line annotations.

2. It is recommended that JavaScript be written between

Iii. javascript: Basic Data Types and composite Data Types

Basic: 5 types

1. Value: integer, real number

2. String "" or''

3. boolean value boolen: True, false

4. null value,

5. undefined

Composite data:

1. Variables

4. Message Box

1. Alert (), confirm (), the prompt box accepts the user's input prompt () <two parameters: 1. input content, 2. displayed value>

V. Basic data type replacement

Number () replace other values with values of the numerical type.

String () replace other types of values with strings

Boolen ()......................................

Parseint () replace string with Integer

Parsefloat () replace string with floating point

6. conditional statements and cyclic statements

If... else... switch case break defalut... while do. While for and C # have the same syntax (for has similarities and differences)

7. Javascript uses the value call method. Each custom row has a return value. If no return statement is written, the default value is undefined.

8. Javascript operation object

1. The object is new from the constructor. It has many built-in functions, also called constructor, such as var ve = new object (), date, array, and so on.

2. Use the object Point property or method to access its own attributes and methods.

9. Define the property name of the text volume object: attribute Value *************************************** **********************

VaR mobile = {make: "motorcycle", year: "2008 "};

VaR detail = Mobile. Make + "<br>" + mobile. Year + "<br> ";

Document. Write (detail );

Result: Motorcycle

2008

10: Using with to access objects (recommended for objects with many members) and using random numbers

VaR S = 5;

VaR arr = new array (5 );

For (VAR I = 0; I <5; I ++)

{

Arr [I] = parseint (math. Random () * 9 );

Document. Write (ARR [I] + "/N ");

}

11: Use strings as array subscript

VaR States = new array ();

States ["Beijing"] = "Beijing ";

For (var I in States)

{

Document. write (I ); //////////////////////////////////////// //// // The result is: beijing character string array subscript

Document. write (States [I]); //////////////////////////////////////// //// // The result is: beijing

}

 

12: array attributes and Methods

Length, Concat merge, join () join status. Join ("-");

Other

MoveBy (): moves 10 pixels to the right of the window and 20 pixels to the bottom.

MoveTo (): Move the window to the main character on the screen

ResizeBy (10, 20): horizontal zoom-in 10, vertical zoom-in 20

////////////// Move the parent window to the main character parent. Window. movto)

This is what I learned in the past two days. I hope to study harder and harder in the future.

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.