onDblClick not working in firefox

For once in my life something works in IE and actually doesn’t work in FF…wow…

Basically what I’m trying to accomplish is this:

A section of an image needs to be clickable once for home page and twice for an archive “secret” page.

What I have:

function goHome(){
window.location = “index.php”;
function login(){
window.location = ‘archives.php’;


<area shape=“rect” coords=“625,8,820,42” href=“index.php” alt=“Home” onClick=‘goHome();’ onDblClick=‘login()’ />

So…this works in IE7 and safari as intended but FF seems to be fighting with me today.

Any thoughts?

Thanks in advance.

The click event happens on the first click. So, the click event is fired before it’s possible for a dblclick to be detected. You shouldn’t expect the browser to run anymore javascript code after you change the location(although it may happen, it generally shouldn’t be depended on).

Use both a click and dblclick on the same element is asking for trouble if the event handlers do mutually exclusive things, which is the case for you.

If you really need this, you can do some trickery by making a delayed event queue. But, I think this is a bad idea. Some people struggle to double click fast enough, or might miss the element on the second click, accidentally triggering the “click” functionality.

Thanks for your advice.

I’ll take a look at changing the “secret entrance” to another spot and keeping it as a single click to avoid future problems.