Basic syntax for JavaScript (i)

Source: Internet
Author: User

A common table unit is known as:

TextBox (Text),

Password box (password),

Multiline text box (<textarea>)

Radio button (radio),

check box (checkbox),

list box (<select> and <option>)

Buttons (button, submit, and reset)

Second, why to learn JavaScript

1. Form verification-Reduce server-side pressure

2. Page dynamic effects

3. Dynamically change page content

What are the components of JavaScript?

Made up of Ecmascript,dom (Document Object model), BOM (Browser object model)

IV. basic structure of JavaScript scripts

<script type= "Text/javascript" >

<!--JavaScript statements; -

</script >

V. Declaration and assignment of JavaScript variables

1. Declare the variable to be re-assigned (var width; width = 5)

2. Simultaneous declaration and assignment variable (var catname= "Leather";)

3. Do not declare direct assignment (width=5)

Vi. data type typeof The return value of the detection variable

Undefined Boolean string number null

The return value of the typeof operator is as follows:

undefined: The variable is declared but not assigned

string: A character literal that is declared in single or double quotation marks

Boolean: True or False

number: integer or floating-point number

object: Objects, arrays, and Null in JavaScript

Seven, operational symbols

1. Arithmetic operators (+,-,*,/,%,++,--)

2. Assignment operator (=,==)

3. Comparison operator (> < >= <= = = =)

4. Logical operators (&& | | !)

Viii. notes

1. Single-line comments start with // , end at end of line,

2. Multi-line comments start with/ * , End with * /, sign/ * ... * /indication

Nine, common input/output

Alert ()

Alert ("hint message");//Popup window hint

Input box hint

Prompt () prompt ("Prompt information", "Default information for Input box");

Prompt ("Please enter name", "Zhang San"); Prompt ("Please enter name");

Basic syntax for JavaScript (i)

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.