By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

Problem: onmouseout being signaled w/o leaving the element!

P: n/a
I have a DIV that contains some anchors arranged vertically. On the DIV
element I have an onmouseout event handler. If I move the mouse over one of
the anchors, and then move it to another anchor (while remaining inside the
DIV), the onmouseout event handler gets triggered even though the mouse never
went outside the DIV. This happens in IE, Opera, and Mozilla.

You can see this problem for yourself here:
http://home.comcast.net/~delerious1/index4.html

Does anyone know why this is happening?

Jul 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
rf

<de*******@no.spam.com> wrote in message
news:3f****************@news.md.comcast.giganews.c om...
I have a DIV that contains some anchors arranged vertically. On the DIV
element I have an onmouseout event handler. If I move the mouse over one of the anchors, and then move it to another anchor (while remaining inside the DIV), the onmouseout event handler gets triggered even though the mouse never went outside the DIV. This happens in IE, Opera, and Mozilla.

You can see this problem for yourself here:
http://home.comcast.net/~delerious1/index4.html

Does anyone know why this is happening?

My reading of the spec at
http://www.w3.org/TR/html4/interact/....html#h-18.2.3 is that the
browser is behaving as expected. The mouse is moving "away" from the
element, that is it is moving into the nested <a> element.

What you are probably thinking of is the IE proprietry onMouseLeave event.
This only occurs when the mouse leaves the boundary of the element.

What are you trying to achieve anyway that can't be done with CSS?

Cheers
Richard.
Jul 20 '05 #2

P: n/a
On Wed, 10 Dec 2003 13:04:00 GMT, "rf" <ma**********@the.time> wrote:
My reading of the spec at
http://www.w3.org/TR/html4/interact/....html#h-18.2.3 is that the
browser is behaving as expected. The mouse is moving "away" from the
element, that is it is moving into the nested <a> element.

What you are probably thinking of is the IE proprietry onMouseLeave event.
This only occurs when the mouse leaves the boundary of the element.

What are you trying to achieve anyway that can't be done with CSS?


I want the entire navigation menu (the DIV element) to disappear when the
mouse leaves it. I will need to use Javascript to set the visibility to
hidden.

It appears the problem is happening because the onmouseout event on the anchor
is bubbling up to the DIV. I should be able to use window.event.cancelBubble
(for IE) or event.stopPropagation() (for Opera/Mozilla) to solve this problem.

Jul 20 '05 #3

P: n/a
rf

<de*******@no.spam.com> wrote in message
news:3f****************@news.md.comcast.giganews.c om...
On Wed, 10 Dec 2003 13:04:00 GMT, "rf" <ma**********@the.time> wrote:
My reading of the spec at
http://www.w3.org/TR/html4/interact/....html#h-18.2.3 is that the
browser is behaving as expected. The mouse is moving "away" from the
element, that is it is moving into the nested <a> element.

What you are probably thinking of is the IE proprietry onMouseLeave event.This only occurs when the mouse leaves the boundary of the element.

What are you trying to achieve anyway that can't be done with CSS?


I want the entire navigation menu (the DIV element) to disappear when the
mouse leaves it. I will need to use Javascript to set the visibility to
hidden.


Wouldn't that be a silly thing to do? How would a user find the navigation
in the first place, random mouse sweeps?

Mystery meat navigation.

Cheers
Richard.
Jul 20 '05 #4

P: n/a
On Wed, 10 Dec 2003 23:41:50 GMT, "rf" <ma**********@the.time> wrote:
Wouldn't that be a silly thing to do? How would a user find the navigation
in the first place, random mouse sweeps?

Mystery meat navigation.


LOL. No that page doesn't contain my actual menu. It just contains simple
code that illustrates a problem. My actual menu has a main menu that never
disappears. When a user moves the mouse over one of the links in the main
menu, a submenu appears (javascript sets visibility to visible). Then the
submenu should disappear (javascript sets visibility to hidden) when the mouse
moves out of the submenu DIV.

Jul 20 '05 #5

P: n/a
rf

<de*******@no.spam.com> wrote in message
news:3f****************@news.md.comcast.giganews.c om...
On Wed, 10 Dec 2003 23:41:50 GMT, "rf" <ma**********@the.time> wrote:
Wouldn't that be a silly thing to do? How would a user find the navigationin the first place, random mouse sweeps?

Mystery meat navigation.
LOL. No that page doesn't contain my actual menu. It just contains

simple code that illustrates a problem. My actual menu has a main menu that never disappears. When a user moves the mouse over one of the links in the main
menu, a submenu appears (javascript sets visibility to visible). Then the
submenu should disappear (javascript sets visibility to hidden) when the mouse moves out of the submenu DIV.


Ah-ha. A statement of the *real* problem.

Well, you are re-inventing wheels. Go over to google and search for
"javascript pulldown menu". There are hundreds of examples there. One of
them should do what you want :-)

One caveat: If you do this then make sure that your navigation still works
with javascript disabled.

Cheers
Richard.
Jul 20 '05 #6

P: n/a
On Thu, 11 Dec 2003 01:52:16 GMT, "rf" <ma**********@the.time> wrote:
Ah-ha. A statement of the *real* problem.

Well, you are re-inventing wheels. Go over to google and search for
"javascript pulldown menu". There are hundreds of examples there. One of
them should do what you want :-)

One caveat: If you do this then make sure that your navigation still works
with javascript disabled.


Yeah I know, but I think those free javascript menus all fix the size of the
text. Isn't it poor web page design to not let the user change the text size?

Jul 20 '05 #7

P: n/a
delerious wrote:
Yeah I know, but I think those free javascript menus all fix the size of the
text. Isn't it poor web page design to not let the user change the text size?


Try the one at http://devedge.netscape.com/ -- it is probably the best out
there.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Jul 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.