Enter HTML5 entry to proficient:<script> label

Source: Internet
Author: User
Keywords tags HTML5 Getting started to master

"Reprint please retain the integrity of the content of the Wind network article, if you do not comply with this principle, we will retain the right to pursue legal responsibility"

<script> Label

Definitions and usage

<script> tags are used to define client script, such as http://www.aliyun.com/zixun/aggregation/33906.html ">javascript."

The script element can contain scripting statements and point to an external script file through the SRC attribute.

The required type attribute sets the MIME type of the script.

JavaScript is typically used for image manipulation, form validation, and content dynamic changes.

Instance

<script type= "Text/javascript" >
document.write ("Hello world!")
</script>

Try it for yourself.

<! DOCTYPE html>
<html>
<body>
<script type= "Text/javascript" >
document.write ("Hello world!")
</script>
</body>
</html>

Differences between HTML 4.01 and HTML 5

The Async property is a new attribute in HTML 5.

In HTML 5, some properties in HTML 4.01 are no longer supported.

Tips and comments

Note: The script executes as follows:

If the Async property is true, the script executes asynchronously relative to the rest of the document, so that the script executes as the page continues to parse.

If the Async property is false and the defer property is true, the script executes after the page finishes parsing.

If both the async and defer properties are false, the script executes immediately, and the page continues parsing after the script has finished executing.

Wind Network (www.ithov.com) Tip: If the src attribute exists, the <script> label must be empty.

Property

The

property value describes whether the Async async definition script executes asynchronously. Type Text/ecmascript text/javascript application/ecmascript application/javascript text/vbscript indicates the MIME type of the script. CharSet CharSet defines the character encoding used in the script. Not supported. Defer defer indicates that the script does not generate any document content. The browser continues to parse and draw the page. Language JavaScript is not supported in LiveScript VBScript other HTML 5. The src URL defines the URL to the file that contains the script (so that you can refer to a file that contains the script instead of inserting the script directly into your HTML document). Not supported in Xml:space preserve HTML 5.

Standard properties

<script> tags support standard properties in HTML 5.

Event Properties

<script> tags support event properties in HTML 5.

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.