Posts: 9
Name: Rohan Shenoy
Location: Thane-Vashi,Mumbai,India
|
The code to include an external JS file is
Code:
<script src="filename.js">
</script>
You have to include the .js extension as well.
Then the next step you should see is in that external .js file, do you have the <script> at the starting of code and </script> at ending. If yes, you should remove them.
<script> & </script> tags are used to indicate that there is a script inbetween them. Because you are linking to a file with .js extension, it is understood that it is containing javascript. So you should remove the <script> and </script> tags.
Eg: If I was to include a external .js file to write Hello World, I would write on the below code in that file:
Code:
document.write("Hello World")
Note that I haven't included the script tags here 
Hope that helps!
__________________
Medical entrance resources for MHT-CET: Please login or register to view this content. Registration is FREE
My javascript showcase: Please login or register to view this content. Registration is FREE
|