Advertisement
Guest User

Javascript to check for timeout K2 Smartform

a guest
Apr 24th, 2015
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.  var IDLE_TIMEOUT = 60;  var _idleSecondsTimer = null; var _idleSecondsCounter = 0; document.onclick = function() {     _idleSecondsCounter = 0; }; document.onmousemove = function() {     _idleSecondsCounter = 0; }; document.onkeypress = function() {     _idleSecondsCounter = 0; }; _idleSecondsCounter = window.setInterval(CheckIdleTime, 1000); function CheckIdleTime() {      _idleSecondsCounter++;      var oPanel = document.getElementById("SecondsUntilExpire");      if (oPanel)          oPanel.innerHTML = (IDLE_TIMEOUT - _idleSecondsCounter) + "";     if (_idleSecondsCounter >= IDLE_TIMEOUT) {
  3.         window.clearInterval(_idleSecondsCounter);
  4.         alert("Time expired!");
  5.         document.location.href = "logout.html";
  6.     }
  7. }
  8. </script>You will be auto logged out in <span id="SecondsUntilExpire"></span> seconds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement