The basics of JavaScript learning notes: javascript learning notes

Source: Internet
Author: User

The basics of JavaScript learning notes: javascript learning notes

Summary: Composition of javascript, role of each component,

I. Composition of javascript

Javascript
ECMAScript (CORE) DOM (Document Object Model) BOM (Browser Object Model)

1.1 ECMAScript

ECMAScript is a scripting language standardized through the ECMA-262, The ECMA-262 specifies the language: syntax, type, statement, keywords, reserved words, operators, objects

1.2 DOM

DOM maps the entire page into a multi-layer node structure. Each component of pages such as HTML and XML is a certain type of node, and these nodes contain different types of data.

1.3 BOM

Controls the parts outside the page displayed by the browser

Ii. <script> Elements

2.1 usage

External Reference javascript file:

Copy codeThe Code is as follows:
<Script type = "text/javascript" src = ".../../XX. js"> </script>

Page embedding javascript code

Copy codeThe Code is as follows:
<Script type = "text/javascript">
Var first = "first variable ";
Alert (first );
</Script>

2.2 <script> attributes of an element

Defer delayed Script: the script will be delayed until the entire page is parsed before execution. Although it is delayed, the browser has downloaded the js file.

Copy codeThe Code is as follows:
<! DOCTYPE html>
<Html>
<Head>
<Script type = "text/javascript" defer = "defer" src = "demo. js"> </script>
</Head>
</Html>

In the preceding example, although the <script> label is in the

Defer only applies to externally introduced script files

Async asynchronous Script: you do not have to wait for the download and execution of the script on the page to asynchronously load other content on the page. Therefore, do not modify the dom during asynchronous loading.

Copy codeThe Code is as follows:
<! DOCTYPE html>
<Html>
<Head>
<Script type = "text/javascript" defer = "defer" src = "demo1.js">
<Script type = "text/javascript" defer = "defer" src = "demo2.js"> </script>
</Head>
</Html>

These are some basic javascript knowledge. I hope that you will not be able to read or fall asleep. Only by laying a solid foundation can you make a qualitative change.

Related Article

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.