JavaScript syntax, dialog box. Branch statements

Source: Internet
Author: User

First, usage

Its location has three pieces, 1, head inside 2, body inside 3,

Its usage is <script></script>

Two or three common dialog boxes

1. Alert ("") warning dialog box only OK and close

2, confirm ("") Ok dialog box has OK button and cancel and close

3, Prompt ("") Pop up a dialog box that can enter text

Third, JS syntax

1. Basic Data type

String, Decimal, Integer, date, Boolean

2. Variables

Variables are usually defined with Var, such as Var year= ""

3. Type conversion

parsefloat () force conversion to decimal

parseint () Forced conversion to an integer

IsNaN () determines whether a valid number type is a number if the return flase is not a number then returns True

Iv. operators

1, Mathematical operations: + (and the meaning of stitching)-*/% (except for the commercial surplus) + +--

2, relational operators: = =! = = = =<

3. Logical operator:&& (with) | | (OR)! Non-

4. Other operators: A+=b (A=A+B)

V. Branch statements

1. if ()

{

Need to execute statement

}

2. if ()

{

Need to execute statement}

Else

{

The rest of the execution statements that do not meet the criteria}

3. if ()

{

Execution that satisfies the condition}

else if ()

{Meet Condition execution}

Else

{

Condition execution Not satisfied}

4, if inlay: After the scope of the specification, what is the small situation need to judge the use

JavaScript syntax, dialog box. Branch statements

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.