when we access a page if it is idle for sometime automatically it should redirect the page automatically .if in btwn mouse on click i done then reset the time again .

here is my code

        <title>Session Timeout Warning</title>
        function settime()
        { alert("hi");
              setTimeout( 'ShowTimeoutWarning();', 120000 );
            function ShowTimeoutWarning ()
                window.alert( "You will be automatically logged out in five minutes unless you do something!" );
                window.location.href = "demo.html";

    <body onLoad="settime();" onClick="settime();">


You forgot to ask your question. Your code looks OK so far.

While you think about the question, take the <script> out of the <head> and put it at the end of the <body>. (See Souders High Performance Web Sites.)