Summary: The composition of JavaScript, the role of each component,
First, the composition of JavaScript
|
Javascript |
|
ECMAScript (CORE) |
DOM (Document Object model) |
BOM (Browser object model) |
1.1ECMAScript
ECMAScript is a standardized scripting language through ECMA-262, ECMA-262 language: syntax, type, statement, keyword, reserved word, operator, object
1.2 DOM
The DOM maps the entire page to a multi-tiered node structure, and each component of the page, such as HTML or XML, is a node of a certain type, and these nodes contain different types of data.
1.3 BOM
Controls the part of the browser that is displayed outside the page
Second, <script> elements
2.1 How to use
Externally referencing JavaScript files:
<script type= "Text/javascript" src= ". /.. /xx.js "></script>
View Code
Page embedding JavaScript code
<script type= "Text/javascript" > var first= "First variable"; alert (firstly);</script>
2.2 Properties of the <script> element
Defer delay script: The script will be deferred until the entire page is parsed before execution, although it is deferred execution, but the browser has downloaded the JS file.
<! DOCTYPE html>
In the above example, although the <script> tag is within the
Defer only applies to externally introduced script files
Async Async Script: Instead of having the page wait for the script to be downloaded and executed, the page can load other content asynchronously. Therefore, the asynchronous load script does not modify the DOM during the load.
<! DOCTYPE html>
Learn JavaScript notes from the beginning (i)--basics