Results 1 to 2 of 2

Thread: call js from js??

  1. #1

    Thread Starter
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    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

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width