Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to include a .js file in a .js file?

    To include a .js file in a .html I write this
    <script language="JavaScript1.2" src="FILENAME" type="text/javascript"></script>

    But what do I write if I wanna include a .js file in a .js file?

  • #2
    Regular Coder
    Join Date
    Mar 2003
    Posts
    176
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you want to write an external file to a page(?)...
    skeleton code:

    //

    var whichFile;

    if(condition_A){
    whileFile="<script...src='A.js></script>"
    }else if(condition_B){
    whichFile="<script...src='B.js'></script>"
    }else{ //condition_C
    whichFile="<script...src='C.js'></script>"
    }
    document.write(whichFile)

    //


    ..or something like that. If you want to call another external js file from within an external js file...no idea.
    Last edited by HairyTeeth; 04-13-2003 at 11:07 AM.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well that is exactly what I wann do lol
    ..or something like that. If you want to call another external js file from within an external js file...no idea.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wouldn't including all the js files in the html document take care of it, if you are using functions (which I hope you are doing in the first place).

    Duniyadnd


  •  

    Posting Permissions

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