Click to See Complete Forum and Search --> : .js files


agthornton
07-16-2003, 03:45 PM
Is is possible to call a .js file from another .js file? If so...how?

Khalid Ali
07-16-2003, 05:45 PM
do you mean calling a function thats in another .js file then yes..

boojum
07-16-2003, 07:00 PM
i dont know of a way. he means some kind of preprocessor include. i would like to be able to do that

AdamGundry
07-17-2003, 02:24 AM
I think you can use document.write('<script type="text/javascript" src="somefile.js"></script>') when the page is loading.

Adam

agthornton
07-17-2003, 10:51 AM
We tried this already, but Microsoft Explorer gives us a syntax error saying that it does not know anything about the functions we are trying to call in the other .js file. What we are trying to do is two things, (1) fix some broken code by replacing it with the functions in the second .js file; (2) keep these functions separate so that they can be called from other files. Any suggestions???

kheidt
07-17-2003, 11:30 AM
You can include two <script type="text/javascript" src="somefile.js"></script> in the HTML. One for each .js file.