Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Who to turn to? Multiple scripts/same page

  1. #11
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Might as well throw my two cents in, if a script is working and you add something to it and it breaks, 99% of the time, you did something wrong. I can't tell what it might be from such a small snippet but, is it supposed to have those empty quotes, are they for an optional target or something, if not, get rid of them. Otherwise, I have no idea what happened. Now on to the larger question of this thread -

    Note: Questions regarding multiple script usage are not usually replied to due to their time consuming nature. See this thread for more information, and this tutorial for one possible solution.

    Aside from the tutorial above which usually is the solution when the problem is two different scripts, you may need to consult:

    http://www.howtocreate.co.uk/tutoria...allshow#refcon

    Which explains how two scripts on the same page may not use the same set of variable names, id names, etc. This is especially important if the problem is two copies of the same script on a page.

    One other approach that works in both situations is to put one script in a borderless iframe. It will look like it is on the same page but, since it really is on a separate page, conflicts are no longer an issue.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #12
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks alot jscheuer1 ... completely forgotten about using iframes to solve this problem...

    well it's working fine now with iframes! thanks!

  3. #13
    Join Date
    May 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    SpeedRacer,

    Was hoping you may be able to assist me. I am at a stand still with a client site and understand through searching the threads that you are the person to talk to when it comes to multiple scripts on one page. Is it at all possible that you could help me out? I am trying to run the HV Menu and the conveyor belt slideshow together. I also have another site that I will have the HV Menu script running along with one of the fader scripts. So your help would be so much appreciated. Here is my testing location for the page that I am having trouble with www.kleaninghouse.com. I will await your response.

    Thanks Tam

  4. #14
    Join Date
    May 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Hints to running multiple scripts on same page

    I just fixed my problem, didn't have any "onload" in the code, but the scripts I had downloaded from Dynamic had the same variable names and function names....so they were fighing with each other. They both lived in separate .js files. I renamed all the variables and the functions, and now the code works just fine.

    Appreciate the help this forum brings.
    Jill

  5. #15
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Basic rules for two scripts on the same page:

    1. If you have two unrelated scripts, just go through and be sure that all variable names and references to them with commands like onClick, etc. are unique.
    2. If you have two of the same instance of the same script, do the same, but you'll have more work because you need to be sure that they have ALL unique parts (with maybe some exceptions if a function can be only used once and works for both). It's like above, but you know there are overlapping parts to begin.
    3. If you have two scripts you wish to be related or work together, this is a much more complex problem that will vary by each script. There's no real set of rules here... just use some logic and see what works.

    These methods aren't foolproof and won't work all the time.

    Hope this is helpful.

    by the way, it's not that we don't want to help you, just that it is very confusing to try to make two scripts work together.
    Sometimes, even if they don't seem to be related, overlapping resources can be in conflict and it can be weird.

    One other approach that works in both situations is to put one script in a borderless iframe. It will look like it is on the same page but, since it really is on a separate page, conflicts are no longer an issue.
    This is a good workaround. Frames would work too, IF they work for your layout.

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
  •