Link to home
Start Free TrialLog in
Avatar of mobrien118
mobrien118

asked on

onClick, onDblClick have different interpretations in IE, Firefox AND Opera. What to do?

I have a webpage that cyales through preloaded frames (div) as a user presses the *next* and *back* form buttons.

I need it to work properly in IE and Firefox. What is the best possible way to facilitate this?

Here is what happens in the different situations:

1. If I simply assign he "onclick" button to call the function for the button:

IE 6 - The first click flips it but if the second follows too sortly (users cycling frames quickly) the second or every other buton click does not trigger the "onClick" handler.

Firefox 1.5.0.3 - The first click and all other clicks perform normally (this is the behavior I WANT!)

Opera 9.0 beta - Same as IE - DOESN'T register the second swift click.

2. If I assign the SAME function to handle BOTH the onClick and onDblClick events:

IE 6 - Behaves Properly (first, second, ... clicks all go to next page)

Firefox 1.5.0.3 -  Now, when i click for the second time it counts as a singl click AND a double click. It flips TWO pages on the second click!

Opera 9.0 beta - STILL DISPLAYS THE SAME BEHAVIOR AS BEFORE - UNBELIEVEABLE!!! It still doesn't flip on the second click!!!! What is wrong with this browser??? I don't even care because this is an internal page and my company doesn't support Opera, but seriously... This is a definate bug.

So the real question is: What is the easiest way/best practice for making this work properly in both IE and Firefox? I want to avoid a real 'hack' if possible. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mobrien118
mobrien118

ASKER

Thanks Zvonko. I am kicking myself for not thinking of that.

Your answer actually inspired me to do something else, though. I am using onMouseUp instead, so it acts a little bit more like the button is actually supposed to. The only 'problem' with this is that you can actually click down somewhere else and let up on the botton and it will still perform its action. This is a pretty minute proplem in most cases, including mine. I would give half the expert points to me, but I can' do that so here you go. Good job.

I am still quite purturbed that these browsers can't act responsibly. In my opinion they all exhibit buggy behavior. A single click should be a single click, and the second click should be a double click and NOT a single click if there already was one. I guess it depends on the situation, though. I would venture to say that IE actually got this one right (not meant to start a discussion as that is for the message boards). And what the heck is Opera even doing?
You are welcome.
And you are right that browser GUI is not perfect.
But what I try to clarify is that people expect too much. A browser was basically a TEXT display application with the ability to open new text file on click on marked words. That was all what you got for free. Now many people ask why you cannot draw and paint with the universal browser, and configure that paint behaviour by JavaScript, VBScript, Perl and so on. The GUI was never designed to be a dynamic Application creator. It got step by step become an Application creation interface, but do not forget that basic usage was and is to display Text streams, not more and not less.

See you,
Zvonko