Home >Web Front-end >JS Tutorial >The basics of JavaScript learning notes_basic knowledge

The basics of JavaScript learning notes_basic knowledge

WBOY
WBOYOriginal
2016-05-16 16:20:221006browse

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

Copy code The code is as follows:


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>


In the above example, although the <script> tag is located within the <head> tag, demo.js will be delayed until the browser encounters </html>. </p> <p>defer only applies to externally imported script files</p> <p> async asynchronous script: There is no need to let the page wait for the script to be downloaded and executed, so as to load other content of the page asynchronously. Therefore, asynchronous loading scripts should not modify the dom during loading. </p> <p></p> <div class="codetitle"> <span><a style="CURSOR: pointer" data="70982" class="copybut" id="copybut70982" onclick="doCopy('code70982')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code70982"> <br> <!DOCTYPE html><br> <html><br> <head><br>             <script type="text/javascript" defer="defer" src="demo1.js"><br>               <script type="text/javascript" defer="defer" src="demo2.js"></script>



These are some basic knowledge of javascript. I hope you don’t want to fall asleep while reading. Only by laying a solid foundation can you make qualitative changes.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Two ways of javascript array output_javascript skillsNext article:Two ways of javascript array output_javascript skills

Related articles

See more