I noticed that when clicking a link in IE, where href is set to a javascript function, the first click will work, but the second click will sometimes not. The third will work, and the fourth will not. In other words, IE will run the javascript function only every time it is clicked. If you press a long pause between clicks, it will run the function every time. But as you click a little faster, it skips all the other clicks. Has anyone else noticed this behavior? I do not get the same behavior in Firefox.
Here is a 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>
Press very slowly and each time increases the counter. Click at least a more moderately fast pace and it skips clicks. This also happens with the onclick and onmousedown events of controls in IE6 / 7/8.
The reason this is a problem is because the application is a Point of Sale system, and we implement on-screen keys for the touch screen. If you press a button / button / key more than once because you are typing too fast, this will not be acceptable.
source share