Detect MouseOver state w/o OnMouseOver event?

S

Steven Kan

I have a script for swapping an image on OnMouseOver(), based on the
selections of two SELECT elements:

http://www.kan.org/misc/comparator.html

When OnMouseOver is triggered, it updates the image's .src with the
string value from the second SELECT element, and on OnMouseOut it
updates it with the first SELECT value.

I also have an OnChange trigger so that it updates the image when the
first SELECT element is changed. This all works fine, assuming that
the mouse is not currently on the image. For example, with your mouse
away from the image, click the first SELECT element and use the arrow
keys to twiddle the value--the image twiddles right along with it.

But if the mouse is currently on the image, then the SELECT OnChange
trigger changes the "wrong" image. For example, mouse over the image
and twiddle the two SELECT elements. It appears as though it's working
incorrectly, until you mouse out and then back over again.

Is there a way to conditionally execute the image swap (the one in the
OnChange script) based on whether the mouse currently is On or Out
relative to the image?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top