-
call js from js??
I want to call a js file from another js file (it needs to be called form another js file as the path will change)
How can i do something like this with java script (the given way does not work):
function open(path){
document.write('<script language="Javascript" src="'+path+'\review.js"></script>')
}
Thanks
Kris
-
I don't think you can unless you define it in the HTML source like:
Code:
<script type="text/javascript" src="JSFile1.js"></script>
<script type="text/javascript" src="JSFile2.js"></script>
then any functions/variables will be accessible between both script files. I have seen this sort of thing in some JS files though:
Code:
document.write('<script language="Java');
document.write('script" src="FILENAME.js"></script>');
Maybe that's the answer?