View Full Version : Is it possible to have 2 mouseover events linked to a single image?
10-29-2004, 08:45 PM
I want to modify the Thumbnail viewer Script II slightly, and turn it into a site navigation system. For the most part I got it to work fine, but the only thing i'm having trouble with is, while using a button instead of a thumbnail image, getting an actual mouseover effect (highlight, press, change, whatever) to work on the button itself (mouseover created using image ready). Because the thumbnail viewer script also calls for an onmouseover event on the same image is it just not possible to have 2 effects linked to the same button? Or am I just not doing it right? I suppose this could fall under the "2 scripts on one page" disclaimer... but even just a simple yes or no it is or isnt possible would be great so I don't waste another full night trying to make it work :rolleyes:
Thanx in advance...
10-29-2004, 08:51 PM
In general, yes, you can have two (or more) onMouseover events within the same tag simply by separating each action with a simicolon. For example:
<a href="#" onMouseover="dothis(); dothat()">
where dothis() and dothat() are two separate functions.
10-29-2004, 09:50 PM
Thanx, that made sense...unfortunitely when I do that I get the IE scripting error popup, so it cant be that easy :(
Appreciate the help tho... i'm gonna keep playing with it til I get it right or my brain turns to mush. ;)
01-09-2005, 10:52 PM
Thanks so much for explaining how to create 2 or more effects in a mouseover script! Now I can create my pages much more professionally!:)
I still only have one problem: I sometimes use geocities! to create pages. when i preview them with a shake applet , they work. but when i view my actual web page, (i which i shortened the addres with shorturl), the shaking does not work. i combined a shake and a sound effect and they both worked on the button text in the geocities preview, but i the real page on the net, only the sound effect works!!!! WHY!!!!? Can anyone help!? :cool:
01-09-2005, 10:54 PM
unfortunitely when I do that I get the IE scripting error popup, so it cant be that easy :(It is. The error is probably located in one of the functions called by the event listener.
01-10-2005, 08:24 PM
mwinter...could you explain what you mean by "error is probably located in one of the functions called by the event listener"...i'm having the same exact issue as malice and couldn't get my script to work. i didn't get an error message though in IE, but my rollover image just simply doesn't work.
here's an example of the way i've got it right now:
<a href="page.html" onmouseover="changetext(content); "document.myimage.src=img2blue.src" onmouseout="document.myimage.src=img2.src"><img src="images/thegraphic_n.gif" width="145" height="23" border="0" name="myimage"></a>
01-10-2005, 11:30 PM
ok...i totally missed it.
i just figured out my problem. i had an extra quotation mark before document.myimage.src.
so nevermind i got it to work now.
01-11-2005, 12:17 PM
document.myimage.srcThe correct way to access an image is using the images collection:
document.images['myimage'].srcBy the way, there is a more maintainable (and less bloated) way to perform rollovers than explicitly adding mouseover/mouseout event listeners to every image. I can't post a link yet as I want to rewrite the script but if you're interested, I'll post again later.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.