The script can be placed in the head of the html page or in the body. Put the script in the body. When the browser encounters the tag, the browser does not know whether the script will insert text or html tags, so the browser will stop analyzing the html page and execute it. script. When adding scripts using src, the browser will do the same thing. Page rendering and user interaction will be completely blocked while the script is processing. Script downloading and execution blocks the downloading of other resources, such as images used to render the page. <br>Location of script <br>For the above reasons, scripts should always be placed at the bottom of the page, in front of </body>. <br><strong>A simple example:</strong> </p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:js;toolbar:false"><html> <head> <title>Script Example</title> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <p>Hello world!</p> <script type="text/javascript" src="file1.js">