JavaScript Timer function for session time out.

<script language=”javascript” type=”text/javascript”>
document.onkeypress= resetTimer
document.onmousemove= resetTimer
document.onmousedown= resetTimer
document.Onfocus= resetTimer

var timerId;

timerId = window.setTimeout(“timeOut()”,7200000);

function resetTimer() {
timerId = window.setTimeout(“timeOut()”,7200000);

function timeOut(){
// do something here

alert(“Your session is times out. You will not be able to continue. Please login again “);
var x=1;
//do something here

What do you think?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s