1. <script> element attributes </strong> <br>The main way to insert JavaScript into an XHTML page is to use the <script> element. This element has 5 attributes: charset, defer, language, and src. , type, the three commonly used ones are type, src, and defer. <br>1. The value of the type attribute is generally text/javascript. This attribute is required, <script type="text/javascript"/>. <br>2. The value of the src attribute is an *.js external file. This attribute is optional, <script type="text/javascript" src="example.js"/>. <br>In this example, the external file example.js will be loaded into the current page. The external file only needs to contain the Javascript code that would normally be placed between the opening <script> and the closing </script>. Just like parsing embedded Javascript code, page processing will also be temporarily stopped when parsing external Javascript files. It should be noted that with the src attribute, additional Javascript code should not be included between <script> and </script>.
3. The value of the defer attribute is "defer", which means that the script can be delayed until the document is completely parsed and displayed before execution. This attribute is optional,