Include JavaScript file in another include file 
Author Message
 Include JavaScript file in another include file

Hallo,

Is there some syntax to include a js file within another js file which in
turn would be included in HTML page using <SCRIPT src="myfile.js"></SCRIPT>?
I am developing a plugin - based engine, and would like to add those plugin
js files to the engine js file rather than every single page which uses this
engine. Thus I could leave the engine file rather clean, and adding new
plugins would take only adding single line to the engine file.

Thanks,

--
-Pavils Jurjans
Information Technology consultations and solutions
Phone: (+371) 9459777
ICQ: 4047612



Sat, 23 Apr 2005 21:52:29 GMT  
 Include JavaScript file in another include file

Quote:

>Is there some syntax to include a js file within another js file which in
>turn would be included in HTML page using <SCRIPT src="myfile.js"></SCRIPT>?

The strict answer is no. The .js file can not have a simple HTML tag. What you
*can* do is dynamically write the script tag though:

someFile.js:

document.write('script lanuage="javascript"type="text/javascript"
src="someFile2.js"><\/script>')

that should be all one line.

Its not a true include in a js file, but, it gets it loaded, which is what you
were after.

--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.



Sat, 23 Apr 2005 22:42:03 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. how to pass parameters in an include file which is included in an asp page

2. Include file for Javascript in WSH

3. Include file in javascript

4. Include JavaScript code within external CSS files

5. Including another postscript file in a postscript file

6. Include JS file from JS file

7. Including a file within a jscript file

8. including other .js files in my script file

9. Import/Include jscript file within a jscript file

10. Problem including EPS file in another PS file

11. Directory Listing of files to include files in the subdirectories

12. include files and/or parameters betw vbs-files

 

 
Powered by phpBB® Forum Software