Use script tags to introduce javascript files (<script type="text/javascript" src="js file address"></script>) in the page. When the browser renders the page, when reading the script element, the browser will not process its content in HTML or XHTML. The browser will notify the browser's script engine to take over the content in the script element.
The type attribute of the script element defines the script type, and the type type is:
1.text/ecmascript (represents that this script is parsed in ECMAScript, that is, based on the ECMA-262 script standard)
2.text/jscript (represents that this script is parsed in JScript. It is a variant of the ECMAScript language implemented by Microsoft in IE browser)
3.text/vbscript
4.text/vbs
(3.4 representations are handled in Microsoft's VBScript, which are completely different scripting languages)
The language attribute of the script element (its attributes were used in early script tags to solve browser compatibility issues):
<script type="text/javascript" src="a.js" language="javascript1.2"></script>
language defines the browser version that supports the script (that is, the browser supports javascript 1.2, then executes the code in the a.js file)
The defer attribute of the script element:
<script type="text/javascript" src="a.js" language="javascript1.2" defer="defer"></script>
The defer attribute is set to "defer", which means that the script will not generate any document content. Therefore, the browser can process the remaining part of the page in advance, and only process the script part when the page processing is finished and the display is ready.
Where the script tag is placed in the page.
There are restrictions on the resources loaded by the browser from the same domain name, so when adding a script to the head element, the script will be loaded first, followed by the rest of the document. Why is it said that putting the script element tags that introduce JavaScript in the head may cause the browser to delay the display of the remaining part of the page? Mainly because the document.write method may be called in the script to modify the document object.
Reference: "Javascript Learning Guide"
The above article comprehensively understands the script tags in js is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.