Click to See Complete Forum and Search --> : can a mouseout be ignored?


chukatz
10-11-2003, 10:39 AM
the following snippet is an example from a JS book,
explaining mouse events. which is fine, and the example
works fine as well, IF you acknowledge the mouseover with
a keypress and not a mouseclick. if you click the mouseover
alert, the mouseout event fires immediately which is probably
normal behavior, but in this case i'd like to have the mouseout ignored. any suggestions?


<html>
<head>
<title> MouseOver - One </title>
</head>

<body>

<a href="#"
onMouseOver="alert('That tickles!!');"
onMouseOut= "alert('That\'s better...');"
onClick ="return false;">elmo
</a>

</body>
</html>

Khalid Ali
10-11-2003, 10:44 AM
the way your code is written, it should not trigger any other event when onclick is activated, did you mean to deactivate onmouse out after you trigger the onclick?

chukatz
10-11-2003, 10:52 AM
no Khalid, even before the 'onclick' fires.

i'm just talking about the two alerts that happen on
mouseover/mouseout.

Khalid Ali
10-11-2003, 10:56 AM
make me understand my friend..your question is confusing..do you only want mouseover event?

if so just delete the onmouseout=".."

chukatz
10-11-2003, 11:28 AM
i sometimes seem to have that efect on people.
let me try to better explain.

when you mouseover the link, the 'tickle' alert is displayed.

while the mouse cursor is still over the link, you acknowledge
the tickle alert by pressing the <enter> key.

assuming the cursor is still over the link at this point,
moving the cursor off the link will cause the "that's better"
alert to be displayed.

so far, so good.

on the otherhand, if the 'tickle' alert is acknowledged by
clicking on the alerts OK button, since the mouse cursor is no
longer over the link, the mouseout event fires immediately
causing he "that's better" alert to be displayed.

i'm guessing this is probably normal behavior, but the effect
(only my opinion) that a mouseout is supposed to generate
is seemingly lost in this instance and i'd like to have it
ignored. hope this made sense. thanks.

Khalid Ali
10-11-2003, 11:41 AM
to me it seems like you will need to remove the onmouseout event call from the link