including a ".js" inside a ".js"
Is there some way to include a ".js" inside another ".js"?
Ater Felis.
[79 byte] By [
stimpy_z] at [2007-11-18 2:26:34]

# 3 Re: including a ".js" inside a ".js"
function include(file){
var e,fs=new ActiveXObject("Scripting.FileSystemObject")
try{var f=fs.GetFile(file)}catch(e){return}
var ts=f.OpenAsTextStream(1),ra=ts.ReadAll()
ts.Close();return ra
}
eval(include("myfile1.js"))
eval(include("myfile2.js"))
# 4 Re: including a ".js" inside a ".js"
That's really only a solution for specific application development, since it requires authorization or low security settings, not to mention is Explorer/Windows only. It's not a solution for a web-page.
mje at 2007-11-8 0:16:38 >

# 5 Re: including a ".js" inside a ".js"
This always works well for me.
<SCRIPT SRC="main.js"></SCRIPT>
and main .js is:
document.write("<SCRIPT SRC='somescriptA.js'></SCRIPT>");
document.write("<SCRIPT SRC='somescriptB.js'></SCRIPT>");
document.write("<SCRIPT SRC='somescriptC.js'></SCRIPT>");
document.write("<SCRIPT SRC='somescriptD.js'></SCRIPT>");
The only drawback is that I don't think you can then write a bunch of code after the document.writes. So your "include" script can only include, and the other scripts have to hold all the code.
Nate Grover