Basic JavaScript Subtotal

Source: Internet
Author: User

Javascript is the scripting language of the browser.

What can be done

1. Read elements from the document, and return the elements to the document and write the text into the document;

2. operate or move text;

3. mathematical calculation of data;

4. Respond to events;

5. Check the current date and time or the last modification time of the document on the user's computer;

6. determine the user's display size, browser version, or screen resolution;

7. Perform deduction based on some conditions. For example, an alarm is triggered when an error message is entered in the form.

Dom.Object Model, with rename, method, and event.

DOM objects use the "." sign to access attributes, sub-objects (or subscripts.

Document window object. Each browser window corresponds to a window object, which is an object created with each instance of the <body> or <frameset> element.Links is the link sub-object, and forms is the form Sub-object. Anchor is a connectable anchor. Applet is smallProgram.

Image ing objects in the range of area <area>.

Imag image object.

String object. For example, mystr = New String

Date object. The UTC time is used to add or subtract the number of milliseconds from the date.

Math data object.

Array object. Construct arr = new Aray ("phf", "host"); or arr = new array (10); // specify the number

Usage

1. Write JavaScript directly in the host language file. <SCRIPT type = "text/JavaScript"> ...... </SCRIPT>

2. Use a. js script file. <SCRIPT type = "JavaScript" src = "JS/login. js">... </SCRIPT>

3. When the host language is HTML. JavaScript scripts can be stored in<Body> part, which is run when the webpage is loaded. Or in<Head> partially declared, called when an event is triggered.

Variable. Declare with VAR (not mandatory), case sensitive.

Logical operators.?? Represents or

Function. Declared with function, can only be placed in the



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.