There are two ways to use <script> elements: embed JavaScript code directly in the page and reference external JavaScript files.
Second, the use of embedded methods, the general wording is:
<script type= "Text/javascript" >
/* Code */
</script>
Third, the general wording of the reference external JavaScript file is:
<script type= "Text/javascript" src= "" ></script> (note that you should not add extra in the middle of <script> and </script> tags JavaScript code. If it is included, it is ignored. )
Iv. in comparison with external references, external references are maintainable and cacheable, so it is recommended that external references be used.
Five, the location of the label storage. <script> tags can be placed anywhere in
Example:
<script type= "Text/javascript" src= "" ></script>
Or
<body>
<!--content here--
<script type= "Text/javascript" src= "" ></script>
<body>
For performance and optimization of front-end pages, the second position is undoubtedly better.
VI. <noscript> is available for browsers that do not support Javsscript or disable JavaScript. The content in,<noscript> will only be present if one of the two cases occurs.
For example:
<title> examples </title>
<body>
<!--content here--
<script type= "Text/javascript" src= "" ></script>
<noscript>
<p> This page requires browser support (enabled) JavaScript.
</noscript>
</body>
JavaScript Getting Started Tutorial two using JavaScript in HTML