Friday, 15 June 2012

javascript - User logout warning and auto timeout -


I have a page that alerts the user every 10 seconds or not, whether or not it remains logged in . If he chooses yes, he will remain logged and the timer runs again and it is alerted after 10 seconds. If not, then it immediately logs out.

Here is the code below.

  & lt; Script & gt; (Function dimer {} {setTimeout (function) {var x = window.confirm ("session is about time-out! Press OK to continue! - Cancel to logout !!!") If (x ) {Dimer (); auto ();} and (window.location.href = '../logoff.php';}}, 10000);}) ()  Scribe; & Gt; function auto () {setTimeout (function () {warning ("you are logged out."); Window.location.href = '../logoff.php';}, 20000);} & Lt ; / Script> What happens when I click Yes, run the dimer and auto function, and after 10 seconds, If I click yes again, and after 10 seconds I get a signal, but until I get the time limit expired.   

itemprop = "Text">

I hope you are trying to alert it every 10 seconds >

instead of setTimeout () Use

setInterval (functionName, Interval);

to help you.


No comments:

Post a Comment