SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multiple JS files won't load

    Hi All,

    Forgive me, I know this is a very newbie question, but I wote a series of JS functions to control an image gallery, and when all the functions were in one file, it loaded and operated reasonable well. I decided to take my addLoadEvent function and break it out into a separate file, and added another JS file that contains an array of images for pre-loading.

    I know the script is fine, because it works when it's all in one file. But when I call the separate files from the HTML like this:

    HTML Code:
    <script language="JavaScript" type="text/javascript" src="../scripts/galleryInit.js"></script>
    <script language="JavaScript" type="text/javascript" src="../scripts/w1-imgPre.js"></script>
    <script language="JavaScript" type="text/javascript" src="../scripts/addload.js"></script>
    it suddenly won't load or function. Any suggestions? I'm tired of looking at this, and pretty frustrated, because this is supposed to work, you know?

    Thanks all!

  2. #2
    SitePoint Member
    Join Date
    Mar 2006
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    do you have a demo page you can link to so we can see what's going on?

    It may just be a case of wrongly specified relative filepaths, have you tried putting something like this at the start of each of those scripts such as

    Code:
    alert("Script 1 is working");
    that way you know if the browser even picked it up..

  3. #3
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bob,

    Thanks for your reply. I finally got it to work on my local system. It was a typical newbie mistake -- I forgot to add a curly brace at the end of my image pre-loading function.

    Uploading now so that I can test from my test site. I'm a little nervous b/c it worked on my local box once before but broke when viewing online.

    Cheers!


Bookmarks

Posting Permissions

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