I have noticed that when clicking a link in IE that has the href set to a javascript function, the first click will work but the second click sometimes won’t. The third will work and the fourth won’t. In other words, IE will only trigger the javascript function on every other click. If you put a long pause between clicking it will trigger the function every time. But as you click just a little faster, it will skip every other click. Has anyone else noticed this behavior? I do not get the same behavior in Firefox.
Here is some sample code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test</title>
<script type="text/javascript">
var count = 0;
function doClick()
{
count++;
document.frm.COUNTER.value = count;
}
</script>
</head>
<body>
<form name="frm" action="">
<input name="COUNTER" value="0"/>
<a href="javascript:doClick();">Click Here</a>
</form>
</body>
</html>
Click very slowly and it increments the counter every time. Click at even a moderately faster pace and it skips clicks. This also happens with the onclick and onmousedown events of controls in IE6/7/8.
The reason why this is an issue is because the application is a Point of Sale system and we are implementing on screen keys for a touchscreen. Having to press a link/button/key more than once because you are typing too fast is not going to be acceptable.
You’re probably experiencing double-click events instead.
That should do the trick.