I noticed that sometimes IE6 / IE7 / IE8 do not always trigger onclick events (from buttons when pressed). It seems that the grace period a couple of seconds after the last onclick event was fired.
I decided to test this behavior using this code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <script type="text/javascript"> window.onload = function(){ document.getElementById('clicker').onclick = function(){ var i = 0 return function(){ i+= 1 this.value = i.toString() } }() } </script> </head> <body> <input type="submit" value="click here" id="clicker"/> </body> </html>
Comparison of the browser (with a speed of 1/4) As you can see, to trigger an event on IE 6-8, it takes about two clicks of a button, while for 9 / firefox / chrome, the event fires every time.
What could be the reason for this? IE6 and 8 were tested on a virtual machine (VirtualBox) with Windows XP.
Other:
- I had the same results with 'submit' and 'button'.
- Using "Onmouseup" as an alternative to onclick seems to work.
source share