1. Introduction
HTML: Responsible for the structure of a page.
CSS: Responsible for the style of a page.
JavaScript: Responsible for interacting with the user.
The 1997 European Computer Protocol (ECMA) was organized to provide a protocol for JavaScript.
1. ECMASCIRPT (the basic syntax is standardized)
2. BOM (Browser object model)
3. DOM (Document Object model)
Features of javascript:
1. Cross-platform
2. Security. (JavaScript code does not directly access the contents of the hard drive)
The difference between JavaScript and Java:
1. JavaScript is a product of Netscape, and Java is the product of Sun Corporation.
2. JavaScript is an object-based language, and Java is an object-oriented language.
3. JavaScript is an interpreted language, and Java is an interpreted, compiled language.
4. JavaScript is a weakly typed language, and Java is a strongly typed language.
When declaring a variable in Java, you must specify the data type of the variable.
JavaScript declares that variables do not need to be explicitly what type of data, and any variable is declared with a keyword var .
2. Introduction method
How to write code for JavaScript.
Mode 1: Can be written using the <script> tag body.
Format:
<script type= "Text/javascript" >
JS Code;
</script>
Mode 2: Introduce an external JavaScript file.
Format:
<script src= "1.js" type= "Text/javascript" ></script>
Attention:
1.<script> is a start tag and end tag, do not end in a tag.
2. If <script> has been used to introduce the JS file, then the <script> tag body can no longer write JS code,
Common JavaScript functions:
Alert ("Show content:"); Pop-up box
document.write ("Data"); Output data to page ...
3, the page comments:
Content of HTML <!--annotations
Comments for CSS/* contents of comments */
JavaScript: The contents of the//comment single-line comment/* contents of the comment */Multiline comment
JavaScript's Preliminary