Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Client Scripting
Expertise: Beginner
Oct 22, 1999

Reference an External JavaScript File

Question:

How do you reference an external JavaScript file from an HTML page?

Answer:

You can reference an external JavaScript file from your HTML page similar to the way you'd reference an image. The syntax is:


This will make your browser download the mycode.js file and interpret the JavaScript code within it—just as if it were included in your page. As with an image, you can use any URL that points to a JavaScript file, including ones on servers other than your own. Note: It is very important that you include a closing tag within your HTML file. The external reference will not work without it.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap