Way to include a .js inside a .js? [duplicate]
Possible Duplicate:
Include javascript file inside javascript file?
Is this possible? Including a reference to another .js that your current .js file code is reliant on instead of having to add 2 includes in every page to ensure that both those files are there?
I开发者_JAVA百科 assume the answer is no...as I have not found any info on it on the net so far.
You can use document.write to create a <script>
element.
But there's no include in js.
coffeeaddict,
Try this article:
http://www.chapter31.com/2006/12/07/including-js-files-from-within-js-files/
I don't know too much about this but I know this is great for intellisense . Take Visual studios for instance they got a vs-doc for jquery. You add a reference of the vs-doc into your .js file and you got intellisense.
Otherwise I don't know if there is a point to it.
Yes, this is possible. It's slightly awkward but you can do it. There are several different ways in fact, but the simplest is to add a <script>
tag with the appropriate "src" value, and put all your dependent code in an "onload" handler of that element. Your script will then run after the other one finishes loading.
精彩评论