JavaScript haga doble clic en el evento?
Guiones
var timer;
var firing = false;
var begen = function(id) {
alert('one click');
};
var popupAc = function(id) {
alert('double click');
};
function cc(id) {
if (firing) {
popupAc(id);
clearTimeout(timer);
firing = false;
return;
}
firing = true;
timer = setTimeout(function() {
begen(id);
clearTimeout(timer);
firing = false;
}, 250);
}
Html
<div id="myID" onclick="cc()">Click Here</div>
Ejemplo: http://jsfiddle.net/LXSZj/11/
Pregunta:
Funciona bien con ie y chrome, pero en Firefox, cuando hago doble clic, obtengo dos funciones de alerta. (Evento de doble clic de alerta y evento de un clic)
¿Cómo puedo arreglarlo?
Gracias.