Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the & lt;script> tag of HTML

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to use the tag of HTML", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use the tag of HTML" article.

Attributes of the tag

Before we introduce the use of tags, we need to understand the attributes of tags; the attributes of tags are:

Src attribute: used to specify the URL of the external script file and to link the external script file.

Type attribute: used to specify the MIME type of the script

Description:

1. MIME type consists of two parts: media type and subtype. For JavaScript, the MIME type is "text/javascript".

2. Some values of MIME type are:

"text/javascript", "text/ecmascript", "application/ecmascript", "application/javascript", "text/vbscript".

Async attribute: this is a Boolean value that specifies that the script is executed asynchronously; it is only compatible with HTML5.

Defer property: this is also a Boolean value that indicates that the script is executed after the document is parsed.

The use of labels

There are two ways to use tags, so let's introduce them in detail:

1. Embed script code within the tag

Tags can be used within or tags to write script code inside the tags to embed them in HTML documents. Let's take a look at an example of embedding script code in an HTML document:

one

two

three

Alert ("php Chinese website\ nURL: www.php.cn")

Effect picture:

2. Use the src attribute to link an external script file

Tags can be used to link external script files through the src attribute, so let's take a look at linked external script files:

one

Note: the HTML document and external script file in the example-jquery.min.js are in the same folder in the same directory:

The above is about the content of this article on "how to use HTML tags". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report