Log in

View Full Version : HELP! Can't get mouseout argument to work



vlane95678
12-15-2005, 12:06 AM
Hello, I am using a js script with a mouseover w/ drop down menu from this web site.

Everything works find but the mouseout argument. When you mouseout, the image stays the same and it should change. Here's the JS code:

<a onmouseover="image1.src='http://www.qdobanv.com/LanitechArtwork/button_home_on.gif', dropdownmenu(this, event, 'anylinkmenu1');" onmouseout="image1.src='http://www.qdobanv.com/LanitechArtwork/button_home_off.gif';" target="_self" href="index.htm">
<img name="image1" src="LanitechArtwork/button_home_off.gif" border="0" width="91" height="39"></a>

And here's the drop down menu code (which I don't think matters anyhow):

<!--1st anchor link and menu -->
<div id="anylinkmenu1" class="anylinkcss">
<a href="http://www.dynamicdrive.com/">Dynamic Drive</a>
<a href="http://www.cssdrive.com">CSS Drive</a>
<a href="http://www.javascriptkit.com">JavaScript Kit</a>
<a href="http://www.codingforums.com">Coding Forums</a>
<a href="http://www.javascriptkit.com/jsref/">JavaScript Reference</a>
</div>


Here's a link to the page to see it not work: http://www.qdobanv.com/new_page_2.htm

CAN ANYONE SEE WHAT THE HECK I'M DOING WRONG?

Twey
12-15-2005, 07:00 AM
You want to use a semicolon, not a comma, to seperate statements.
onmouseover="image1.src='http://www.qdobanv.com/LanitechArtwork/button_home_on.gif', dropdownmenu(this, event, 'anylinkmenu1');"
The problem is the fact that you've given your Image objects the same names as your actual images. If you change the names of these:
image1 = new Image();
image1.src = "http://www.qdobanv.com/LanitechArtwork/button_home_on.gif";
image2 = new Image();
image2.src = "http://www.qdobanv.com/LanitechArtwork/button_menu_on.gif";
image3 = new Image();
image3.src = "http://www.lanitech.com/ArtworkNew/Button-Portfolio-On.gif";
image4 = new Image();
image4.src = "http://www.lanitech.com/ArtworkNew/Button-RequestAQuote-On.gif";
image5 = new Image();
image5.src = "http://www.lanitech.com/ArtworkNew/Button-Contact-On.gif";so that they don't conflict with the actual HTML images, you'll be fine.

vlane95678
12-15-2005, 04:38 PM
Hi, you said to change the "," to a ";" and I did, but I am not quite sure about your second statement to change names of these: which are my preloaded images. Not sure what "change the names" means? Can yo u please clarify? Thanks much!

Twey
12-15-2005, 04:49 PM
For example:

image1_p = new Image();
image1_p.src = "http://www.qdobanv.com/LanitechArtwork/button_home_on.gif";
image2_p = new Image();
image2_p.src = "http://www.qdobanv.com/LanitechArtwork/button_menu_on.gif";
image3_p = new Image();
image3_p.src = "http://www.lanitech.com/ArtworkNew/Button-Portfolio-On.gif";
image4_p = new Image();
image4_p.src = "http://www.lanitech.com/ArtworkNew/Button-RequestAQuote-On.gif";
image5_p = new Image();
image5_p.src = "http://www.lanitech.com/ArtworkNew/Button-Contact-On.gif";

vlane95678
12-15-2005, 05:15 PM
Hello again,

I've changed my preload image script as you recommended and still my mouseout doesn't work. Plus I separated the statements with a semi colon.

Anything else you can see wrong? I'm at a complete total loss on this one :-(

(PS thanks for the quick reponses!)

Twey
12-15-2005, 05:26 PM
Hm, no. Very peculiar.
At least the mouseover works for me now -- it didn't before.

vlane95678
12-15-2005, 06:01 PM
I know!? It's driving me NUTZ!
Thinking about canning the script all together, skip the drop down and use something else.

Twey
12-15-2005, 06:15 PM
There's nothing wrong with the dropdown. Try rewriting that bit of your page from scratch. There's got to be something wrong with it :-\