1. JavaScript is a scripting language designed specifically for interacting with web pages. Its composition
ECMAScript (Core) DOM (Document Object Model) BOM (Browser Object Model)
1.1ECMAScript
ECMAScrip defined by ECMA-262 has no dependency on web browsers. ECMA-262 only defines the basis of this language and provides core language functions
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 (Document Object Modle)
DOM is an application programming interface (API, Application Programming Interface) for XML but extended for HTML, providing methods and interfaces for accessing and operating web content
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(Bower Object Modle)
Control parts other than the page displayed by the browser. BOM only handles browser windows and frames, providing methods and interfaces for interacting with the browser
2. <script> element<br>
2.1 Quoting javascript files <br>
External reference javascript file: </p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="81093" class="copybut" id="copybut81093" onclick="doCopy('code81093')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code81093">
<br>
<script type="text/javascript" src="../../XX.js"></script>
The page embeds javascript code
JavaScript code contained within the <script> element will be interpreted from top to bottom</p>
<p>2.2 Attributes of <script> element</p>
<p>Defer delay script: Tell the browser to download immediately. The script will be delayed until the entire page is parsed before execution. Defer only applies to externally introduced script files</p>
<p></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="50781" class="copybut" id="copybut50781" onclick="doCopy('code50781')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code50781">
<br>
<!DOCTYPE html><br>
<html><br>
<head><br>
<script type="text/javascript" defer="defer" src="example.js"></script>