Forum Moderators: open

Message Too Old, No Replies

Including a second JavaScript file from the first

Is it possible?

         

zCat

4:13 pm on Nov 27, 2005 (gmt 0)

10+ Year Member



This is one of those things I haven't been able to find the right keywords for searching, partly because I'm not even sure if it's possible.

Anyway: I include a JavaScript file within the HTML as always thus:
<script src="/myscript.js" type="text/javascript"></script>

"myscript.js" requires functions from "mylibrary.js". I'd like to avoid adding another "<script>" tag to the HTML page; is it possible to do something like

include("/mylibrary.js");

from within "myscript.js"?

kaled

5:01 pm on Nov 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This was discussed some time ago. I think the suggested solution was to use document.write() to add another <script> element.

Kaled.

zCat

8:28 pm on Nov 27, 2005 (gmt 0)

10+ Year Member



Thanks. I've looked around a bit more and found nothing along the lines I've been looking for, in which case it'll be easier to just have multiple <script> tags on each page.

Another day, another language...