p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   Delay mouse events until page loaded? (http://p2p.wrox.com/showthread.php?t=29200)

John K. King May 11th, 2005 11:06 AM

Delay mouse events until page loaded?

I'm building a vertical navigation bar and my goal is to make it work in a similar fashion to what you can see, for example, at the Seattle Times (http://www.seattletimes.com).

I'm using the onmouseover() and onmouseout() events to change the text and background colors as the mouse goes over a menu item.

(question: can 'hover' be used to accomplish the same effect? I've tried it but haven't been successful with anything other than the text-decoration attributes)

What I have works fine except for one thing: while working with it, I had a Javascript console open and I saw what initially appeared to be spurious errors and warnings complaining about the functions and objects related to the onmouseover() and onmouseout() events.

The messages have to do with the function not being defined, or an object in the function not being an object.

After playing with it for a while, I've convinced myself that the messages are not spurious. I believe that what happens is this: If I click a menu item and the page reloads contracting an existing submenu and exposing the new submenu, moving the mouse over one or more of the menu selections, firing the events, before the page finishes loading is what causes the messages. If I am reasonably deliberate about not moving the mouse immediately after clicking on a menu item, no messages.

Is there someway to suppress mouse events while the page is loading, or is there another way to accomplish the same goal without using onmouseover() and onmouseout()?

I'm not using DHTML and the display style attribute to hide and show submenus because a new page to loads with each menu selection, so there is no need to use DHTML. In this application, the page displayed does not remain the same as one peruses the menu.



John K. King May 11th, 2005 11:19 AM


Thinking about it some more, it could be that the messages are generated as the mouse events are generated while the old page unloads rather than as the new page loads. I'll have to look into determining which it is.

Still, if anyone can help, I'd appreciate it.



All times are GMT -4. The time now is 06:10 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.