javascript-Basic Articles <Script></script> basic use

Source: Internet
Author: User

1. Properties:

1.1.async: Optional, indicates that the script is loaded immediately, but does not interfere with other actions on the page, such as downloading other scripts.

Instance:

  

<! DOCTYPE html>"UTF-8"> <title></title> [email protected]163. com time: .-Geneva- -Description: Put content here-<script type="Text/javascript" Async="Async"Src="Test1.js"></script> <script type="Text/javascript" Async="Async"Src="Test2.js"></script> </body>

Note: There are two external script files that can be downloaded immediately without interfering with each other, and you need to ensure that there are no interdependencies between the two files

1.2 Defer: Optional, indicates deferred loading until the document is fully parsed and then executed. Useful only for external files.

Instance:

    

<! DOCTYPE html>"UTF-8"> <title></title> Description: Put content here-<script type="Text/javascript"Defer="defer"Src="Test1.js"></script> <script type="Text/javascript"Defer="defer"Src="Test2.js"></script> </body>

Note: In HTML5, the requirement for deferred scripting requires that the script be executed sequentially in the order in which the delay script is presented, and the first deferred script executes prior to the second deferred script. The two scripts are executed before the Domcountentloaded event. In reality, deferred scripts are not necessarily executed in the order in which they appear, nor do they precede the domcountentloaded event.

1.3 CharSet: Optional, indicates that the character set of the code specified through the SRC attribute has been ignored.

1.4 Language: Abandoned, do not dig deep.

1.5 src: Contains the external file to execute the code.

1.6 Type: optional, which represents the type of script content that is used by the writing code. Text/javascript and Text/ecmascript have not been recommended, but are based on user habits. It is still recommended, but it is not necessary to specify this property, the default value is Text/javascript

Javascript-Foundation <Script></script> Basic use

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.