views:

168

answers:

2
<html>   
 <head>   
 <script>

var i;
i = 0;
function loop() { 
     i = i + 1;
     alert(String(i));
     setTimeout("loop()",1000);
}
setTimeout("loop()",1000);  
</script>   

 </head>   

 <body>   

</body>   
 </html>  

Please try the above code in IE8 it will not give alert message for every 1 sec if you hold right click.

But in firefox it will give alert message even though if you dont release the right click.

I want the firefox functionality in IE8.

A: 
setTimeout("loop()",1000);

should be

setTimeout("loop",1000); // without braces

or

setTimeout(function(){ loop(); },1000); // with an anonymous function

EDIT: i missunderstood the question and thougt the IE does nothing - so i don'T think this is the answer you 're looking for.

oezi
+1  A: 

The reason for this is that the holding down the button is a blocking event. That means that all executions stops while it is being executed.

There is nothing you can do about this.

Are you using the right mouse button for something special, other than the default context menu?

Sean Kinsey