The basics of the basics of JavaScript learning notes

Source: Internet
Author: User

Overview: The composition of JavaScript, the role of each component,

One, the composition of JavaScript

Javascript
ECMAScript (CORE) DOM (Document Object model) BOM (Browser object model)

1.1ECMAScript

ECMAScript is a ECMA-262 standardized scripting language that 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, HTML or XML, is a type of node that contains different types of data.

1.3 BOM

Control the part of the page that the browser displays

Second, <script> elements

2.1 Use Mode

External referencing JavaScript file:

Copy Code code as follows:

<script type= "Text/javascript" src= ". /.. /xx.js "></script>

Page embedding JavaScript code

Copy Code code as follows:

<script type= "Text/javascript" >
var first= "First variable";
alert (a);
</script>

Properties of 2.2 <script> elements

Defer delay script: The script will be delayed until the entire page is resolved to execute, although it is deferred execution, but the browser has downloaded the JS file.

Copy Code code as follows:

<! DOCTYPE html>
<script type= "Text/javascript" defer= "defer" src= "Demo.js" ></script>

In the example above, although the <script> tag is in the

Defer only applies to externally introduced script files

Async Asynchronous Script: Do not have to let the page wait for the script to download and execute, thus asynchronously load the other content of the page. Therefore, the asynchronous load script does not modify the DOM during load.

Copy Code code as follows:

<! DOCTYPE html>
<script type= "Text/javascript" defer= "defer" src= "demo1.js" >
<script type= "Text/javascript" defer= "defer" src= "Demo2.js" ></script>

Are some of the basics of JavaScript, I hope we do not read to sleep, only to lay a good foundation for the possibility of qualitative change oh.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.