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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2 scripts on one page - having troubles.

    I'm not very familiar with javascript - the only thing I've done with it is cut/paste scripts that other people have written. I'm having a problem with a particular webpage, have read the FAQ, and some articles / posts about putting multiple scripts on a page, but I still can't figure out what to do, having very little javascript experience.

    Here's the problem. On a website I'm making (a redesign of an existing site), I have a mouseover script - each navigation link image mouses over to a different image. That's working like a charm.

    The trouble is, there is an image map on one page of the site. When each part of the map is moused over, a tool tip appears telling you what radio stations in that state carry a particular radio program.

    On the original site, www.inpeoria.org/stations.htm, this works perfectly.

    But, once I've added the tool tip script to the new page - the one that already has the navigation mouseovers on it - it doesn't work. The URL of that page is www.quantawebdesign.com/gvrdev/stations.html

    Can anyone point me in the right direction? I've tried various things based on things I've read but haven't been able to get it to work. I'm at my wit's end ~

    Thanks so much!!

    best,
    Denise

  • #2
    New Coder
    Join Date
    Jul 2003
    Location
    Houston, Texas
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Show me your code and I'll try to help you
    Beyond a critical point within a finite space, freedom diminishes as numbers increase. ...The human question is not how many can possibly survive within the system, but what kind of existence is possible for those who do survive."

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Have you looked at

    http://www.javascriptkit.com/javatut...iplejava.shtml

    The problem is either that one or more variable names are duplicated e.g. var x occurs in both scripts, or more likely
    there are multiple window.onload =
    events (i.e. one in each script). Only the last one will work as each over-writes the previous one.

    The tutorial tells you how to resolve this, basically by deleting the lines starting window.onload =
    and then calling the scripts from the body tag as follows:-

    <body onload = "dothis(); dothat();" .....................>

    Hope this solves your problem, which is a very common one when scripts are simply cut and pasted.
    Last edited by Philip M; 03-21-2004 at 08:44 AM.


  •  

    Posting Permissions

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