Last Updated : Apr 11, 2023
The <script> element is not permitted in external script files. Just where you'd have typed the script is where you should point to a external script file.
In other terms, we can argue that scripting refers to languages whose execution depends on the assistance of another language.
- The browser is informed of the HTML version we are using in our first line, which is <HTML>. Tags are the foundation of HTML documents.
- Then we close head.
- Next comes the body tag, which defines the body of the webpage. You can create this same content for your site in one specific location.
- Then we create a form and under the form we create a button.
- Then we close the form.
- Then we define the script as hello.js.
- Finally, after closing all tags, </script></body></html> but also code should be executed.
If we would like to utilize the same code in several HTML documents, it becomes quite useful.
Also, it spares us from having to repeatedly write the same code and makes maintaining web pages simpler.