Tuesday, July 30, 2019

Include a JavaScript file






Possible Duplicates:
Include javascript file inside javascript file?
How do you dynamically load a javascript file? (Think C's #include)






Is there a way to include a JavaScript file from a .js file?
You know: like how I link .css files at the top of a .css file.






xxx.js contains:



Some sort of @import yyy.js
followed by other js commands.

Answer



this is my workaround to do this:



if (typeof (jQuery) == "undefined") 
document.write(unescape("%3Cscript src='" + server_url + "/js/jquery-1.4.2.min.js' type='text/javascript'%3E%3C/script%3E"));



of course, for anything other than jquery you'd have to figure out if you needed it or not then do the same with that file.



server_url needs to be set also.



here is a working example of this



http://my.digitalscout.com/Widgets/schedule.html


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...