Link to home
Create AccountLog in
Avatar of proee
proee

asked on

Ignore onMouseDoubleClick to allow for rapid onMouseDown event captures (IE only)

I have an online javascript calculator that uses html/CSS for the GUI buttons.  These calculator buttons are using onmousedown to capture the user clicking on the GUI.  This works great, but in IE, if the user clicks very quickly (for example types the number "1.333") then IE interprets the clicking of the "3s" as a doubleclick event and I do not get the correct number of onmousedown events.  This is extremely annoying and only in IE.  (FF, Safari, and Opera all process the event with the correct number of onmousedown events.)

I've done some research into what events are being fired for IE.  If you do two quick clicks you fire the following sequence of events:

mousedown fired... Then mouseup fired... Then click fired... Then mousedown fired... Then mouseup fired... Then click fired... Then dblclick fired...

So it appears as if the dblclick event trumps any mouedown events.

What approach should I take to this problem?  Again, this seems to be an IE only problem but I need this solution to work correctly in conjunction with all the other browsers that work fine.

ASKER CERTIFIED SOLUTION
Avatar of robacarp
robacarp
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of proee
proee

ASKER

I've thought about this approach.  Wondering if there might be less of a "hack" than this.  I have a lot of buttons on the calculator gui so I'd have to add a ton of onmousedblclick handlers all over.  I was hoping to handle it with an event capture somehow.  Thanks for the suggestion, I'll try it if I don't hear of a better approach.