HTML's tag is used to specify client-side scripts, which can help us place scripts in HTML documents. You can embed script code within the <script> tag, or use the src attribute to link to an external script file. This article will introduce to you how to use the <script> tag element in HTML. ##Attributes of the tag<span style="font-size: 18px;">Introducing how to use the tag Before, we need to first understand the attributes of the <script> tag; the attributes of the <script> tag are: <p><p>src attribute: <strong> is used to specify the URL of an external script file and link to the outside script file. <p>type attribute: <strong> Used to specify the media (MIME) type of the script Description: <p>1. The MIME type consists of two parts: media type and subtypes. For JavaScript, the MIME type is "text/javascript". <p>2. Some values of MIME type are: <p>"text/javascript", "text/ecmascript", "application/ecmascript", "application/javascript", "text/vbscript" . <p><p>async attribute: <strong>This is a Boolean value used to specify that the script is executed asynchronously; only compatible with HTML5. <p>defer attribute: <strong>This is also a boolean value used to indicate that the script should be executed after parsing the document. <p>##<script>Usage of tags<span style="font-size: 18px;"><strong>##<script>There are two ways to use tags. Let’s introduce them in detail below:<p>1. Embed script code in the <script> tag<p><strong>The<script> tag can be used within the <body> or <head> tag. Write script code inside the ;script> tag to embed into the HTML document. Let’s take a look at an example of embedding script code in an HTML document: <pre class="brush:js;toolbar:false"><script type = "text/javascript"> alert("php中文网\n网址为:www.php.cn"); Rendering: 2. Use the src attribute to link external script files tag can be used to link external script files through the src attribute. Let’s take a look at linking external script files: <pre class="brush:js;toolbar:false"><script type="text/javascript" src="jquery.min.js" >Note: The HTML document in the example and the external script file-jquery.min.js are in the same folder in the same directory:Summary: The above That’s the entire content of this article, I hope it will be helpful to everyone’s study.