[Javascript] Including one javascript file within another

Rick Holcomb rholcomb at holc.biz
Wed Oct 12 12:56:46 CDT 2005


I have a script file that I want to use as a variable script (will be
changed by the server).
I want to include that file in another javascript file.
The included file really only contains the definition of a variable.
How can I do this.

Contents of mainfile.js:

<!-- Begin
var swidth=270
var sheight=20
var sspeed=6
var wholemessage=''

<!-- include include.js here
<!-- this include defines the mainmessage variable

var wholemessage='<div>' + mainmessage </div>'

<!-- End


Contents of include.js
<!-- Begin
var mainmessage = 'main message goes here!'
<!-- End





More information about the Javascript mailing list