Getting Started with JavaScript (1)

Source: Internet
Author: User
Tags script tag

I. JavaScript OverviewJavascript:

A loud and elegant name, but it doesn't really matter to Java. Most of this is to better market and promote JavaScript through the name of Java.

What can JavaScript do?

It is mainly embodied in two aspects:

1. Enhance the page dynamic effect (such as: drop-down menu, picture Carousel, information scrolling, etc.)
2. Achieve real-time and dynamic interaction between the page and the user (e.g., user registration, login verification, etc.)

Features:

It is an explanatory type, dynamic type, weak type, prototype-based, object-oriented scripting language.

Composition

1. ECMAScript is mainly composed of syntax, type, statement, keyword, reserved word, operator, object, etc.
2. DOM (Document Object model).
3. BOM (Browserobjectmodel) Browser object model.

Development tools:

1. Compiler: I use Dreamweaver, of course, you can also choose other, such as sublime.
2. Browser: Chrome, Firefox, IETester
3. Debug tool: Firebug

Second, Hello JavaScript

The script can be in the <body> or

    Alert ('Hello JavaScript'); 8 </script> 9    

When the JS code is more and more large, we'd better save it as a. js file, which can be introduced via SRC. You cannot add any code to the script tag, otherwise the code cannot be executed.

1 <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 2 

In Myfirstjs.js, the code can be written directly, without the need to add a script tag.

1 alert (' Hello JavaScript ');

Third, comments

Single-line Comment
/*
* This is a multi-line
* Notes
*/

Iv. Variables

use the var keyword when defining a variable, followed by a variable name. such as 1 var name = ' Wendy ';

For variable names:

1. You must start with a letter, underscore, or dollar sign, followed by letters, underscores, dollar signs, and numbers.

2. Case sensitive.

3. The use of JavaScript keywords and reserved words is not allowed.

The keywords and reserved words are shown in the following table:

You can declare many variables in one statement. The statement starts with VAR and separates the variables with commas:

1 var name= "Gates", age=56, job= "CEO";

Declarations can also span multiple lines:

    age=56,3     job= "CEO";    

To be continued ...

Getting Started with JavaScript (1)

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.