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, commentsSingle-line Comment
/*
* This is a multi-line
* Notes
*/
Iv. Variablesuse 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)