View Full Version : 2 scripts on one page - having troubles.

03-21-2004, 02:03 AM
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!!


03-21-2004, 04:38 AM
Show me your code and I'll try to help you

Philip M
03-21-2004, 08:40 AM
Have you looked at


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.