A: 

I must be missing something. Your button has an onclick that says to show an alert box. There's no code there trying to delay that alert.

I can't figure out how on earth FF and IE would not display the alert immediately when clicking the button.

If what you want is for fnAlert to be called 5 seconds after a mousemove or a click of the button, you should set your onclick on the button to "fnTimeOut()"

Juan Mendes
Note that I put: ==> document.onmousemove = fnTimeOut; <==In the onmousemove of page the function fnTimeOut will be always triggered. Then if I move my mouse to click in the button then fnTimeOut will be triggered also. But should be triggered after 5 seconds, not immediately. The problem occurs only in Chrome.
Diogo Fernandes
A: 

Nobody knows? So far I'm not understanding ...

Diogo Fernandes
A: 

onmousemove gets fired everytime your mouse moves over the document, so your the alert only shows after the mouse stops moving.

Saying that, it worked fine on my Chrome install, this is the following code.

<html>
<head>
  <script>

  document.onmousemove = fnTimeOut;

  var t = null;

  function fnAlert()
  {
      alert(2);
  }

  function fnTimeOut()
  {
      clearTimeout( t );
      t = setTimeout( fnAlert, 5000 );
  }
  </script>


</head>
<body></body>

</html>
Kinlan
Ok. You are correct. But, what happens if you put a button on the page with the code:<input type="button" onclick="alert(1)" value="ok">And you change the code of fnAlert to window.location.href = "login.asp"?In my crhome the user is redirected immediately to login page when you click in the button! It´s a big problem...
Diogo Fernandes
Can you post all the HTML, as what I have works as expected, fnAlert is called 5 seconds after I stop moving the mouse. The button displays 1 when clicked.... however if it takes me 5 seconds to click the alert then I would expect function to fire.
Kinlan