The src attribute of the SCRIPT element is used to import an external JavaScript file into the document.
<script type="text/javascript" src="script.js"></script>
| Attribute | Value | Explanation |
|---|---|---|
| type=" " | text/javascript | MIME type |
| src=" " | URL | the URL of the external JavaScript file |
<html> <head> <title>TAG index</title> <script type="text/javascript" src="script1.js"></script> </head> <body> <script type="text/javascript" src="script2.js"></script> </body> </html>