faqts : Computers : Programming : Languages : JavaScript : Document

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

163 of 257 people (63%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How can I include another .js file in a javascript file?

May 22nd, 2000 15:27
Chris Durkin, Martin Honnen, oops - deleted by mistake - sources are Romain Xie, Matthew Glidden


You can insert a file by using "document.write" with src line of the 
file you wish to include. For example, if you want to include a list of 
variables with a list of functions and use separate files, you could 
include this line in the functions file:
var baseHref = "http://yoursite/";
document.write('<script language="javascript" src="' + baseHref 
+ 'variables.js"></script>');