Summary: The composition of JavaScript, the role of each component,
1. The composition of javascript
javascript
ECMAScript (Core) DOM (Document Object Model) BOM (Browser Object Model)
1.1ECMAScript
ECMAScript is a scripting language standardized through ECMA-262. ECMA-262 specifies the language: syntax, types, statements, keywords, reserved words, operators, objects
1.2 DOM
DOM maps the entire page into a multi-layer node structure. Each component in a page such as HTML or XML is a certain type of node, and these nodes contain different types of data.
1.3 BOM
Control parts other than the page displayed by the browser
2. <script> element </strong></p>
<p>2.1 How to use</p>
<p> External reference javascript file: </p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="61773" class="copybut" id="copybut61773" onclick="doCopy('code61773')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code61773">
<br>
<script type="text/javascript" src="../../XX.js"></script>
Embed javascript code in the page
2.2 Attributes of <script> element</p>
<p> Defer delay script: The script will be delayed until the entire page has been parsed before execution. Although the execution is delayed, the browser has already downloaded the js file. </p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="31461" class="copybut" id="copybut31461" onclick="doCopy('code31461')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code31461">
<br>
<!DOCTYPE html><br>
<html><br>
<head><br>
<script type="text/javascript" defer="defer" src="demo.js"></script>