This points to a physical folder in your file system that contains the same files seen from Visual Studio. In this example, we will see how we can include an external JavaScript file in an HTML document. If you want to run the same JavaScript on several pages in a web site, you should create an external JavaScript file, instead of writing the same script over and over again. The beginning will include a short introduction to JavaScript, while the rest of the guide will focus on various ways of adding JavaScript to HTML. Generally, JavaScript code can go inside of the document section in order to keep them contained and out of the main content of your HTML document. Embedding the JavaScript code between a pair of tag. Inline JavaScript is placed either in the or tags. Create external JavaScript file with the extension .js. It also saves us from the task of writing the same code over and over again and makes it easier to maintain web pages. This is handy if you need to use the same scripts across multiple HTML pages, or a whole website. Here’s how the HTML file will look after we add the code: If you want to display the time within the body of the page, you will have to include the script within the tags of the HTML page. External JavaScript file only contains JavaScript code and nothing else, even the tag are also not used in it. For example, if you had your own custom JavaScript file named ‘script.js’ and wanted to add its functionality to your HTML page, you would add However, static pages are slowly becoming a thing of the past. It is easier to manage your code when it's split up among seperate files. HTML File Paths; How to allow multiple file uploads in HTML forms. CSS/JS instruction files: catalog CSS file, catalog JavaScript file; HTML instruction files (to view the code, right-click and save the link to your computer): HTML email header, HTML email footer . The temptation is to ad d the external files directly to your index.html file. We can understand this more clearly with the help of an example, how to add JavaScript to html. These files can be referenced from within the HTML documents, just like we reference CSS documents. In this article, we’ll learn two methods of adding JavaScript to HTML: Add directly to an HTML file between tags. JavaTpoint offers too many high quality services. The