1. First create a Folder named "Scripts" and add a file with a name called "sample.js" and save it in the folder. The JS files has to be given the extension ".js".
2. Save a index.html file in the same folder.
Need a add script tag to with the source sample.js
In index.html
<script src="sample.js"></script>
In sample.js
alert("Hello World");
The alert popup will be displayed with the message "Hello World" as soon as your page is loaded.
2. Save a index.html file in the same folder.
Need a add script tag to with the source sample.js
In index.html
<script src="sample.js"></script>
In sample.js
alert("Hello World");
The alert popup will be displayed with the message "Hello World" as soon as your page is loaded.
No comments:
Post a Comment