Log in

View Full Version : A mystery: Opera and ondblclick



Catfish
01-28-2006, 01:28 AM
Greeting Wiseman of DynamicDrive,

Regarding:

<img ALT="Sitemap" src="images/sitemap.png" width="150" height="154" name="sitemap"
onclick="sitemap.width=697; sitemap.height=716"
ondblclick="sitemap.width=150; sitemap.height=154">

It works in FF and IE, but not I Opera (version: 8.51) and I can’t figure out why!

The onclick works fine in Opera, but not the ondblclick.

I am very happy for any help.

Thank you :)

jscheuer1
01-28-2006, 05:52 AM
More of a mystery is why it works in those other browsers. Every dblcklick is a click first and, if it is a click, it then is really only a click followed by a click (once the first half is used to execute the onclick code). Generally, it is not recommended to use click and dblclick on the same element, for this very reason. You could get rid of the dblclick and make the click a toggle perhaps:


<img alt="Sitemap" src="images/this.png" width="150" height="154" onclick="if(this.width=='150'){this.width='697';this.height='716'}else{this.width='150';this.height='154'};">

Catfish
01-28-2006, 03:13 PM
With such logic reasoning I guess there is no real mystery. You point makes perfect sense.

The solution you provide with merely the “onclick” element is an even more eminent solution than making the ondblclick/onclick dilemma work.

Thank you very much for an easily put answer and solution.:D

Jon