spsree 0 Newbie Poster

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

<html>
    <head>
        <title>Session Timeout Warning</title>
        <script>
        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";
            }

        </script>
    </head>
    <body onLoad="settime();" onClick="settime();">

    </body>
</html>