Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 11th, 2005, 11:06 AM
Authorized User
 
Join Date: Jun 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default Delay mouse events until page loaded?

Hi:

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.

Thanks,

John


 
Old May 11th, 2005, 11:19 AM
Authorized User
 
Join Date: Jun 2003
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi:

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.

Thanks,

John





Similar Threads
Thread Thread Starter Forum Replies Last Post
check if page is loaded darkhalf Javascript 1 October 4th, 2005 05:26 AM
how to check if page is already loaded? phpworker Javascript How-To 0 July 31st, 2005 11:49 AM
mouse events calvados Pro VB.NET 2002/2003 6 January 15th, 2005 08:03 AM
How to trap Mouse events on Title bar/Caption bar chiefouko Pro VB.NET 2002/2003 0 September 21st, 2004 02:42 AM
Page Loaded in Seconds Scripts hcweb Classic ASP Basics 8 February 25th, 2004 09:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.