anifled
12-05-2003, 09:27 PM
I have a page with links. When the link is selected the linked page is displayed in the page where the link was selected. On all my pages I use the following code for time outs. The problem I have is when I select the link the timer is still going on the parent page. It doesn't reset or stop. On the child page
activity may be happening but everything times out when the parent page times out. How do I stop the timer when I am on the child page and how do I reactivate it when I exit the child page. Any help would be appreciated.
var seconds = 10;
var counter = seconds;
function countDown() {
window.status = "Session will time out in " + seconds + "seconds";
if(seconds <=0) { alert("Your session has timed out.");
window.parent.location("login.html")
}
seconds--;
window.setTimeout("countDown()",1000);
}
function resetCounter() {
seconds = counter;
}
in the body tag I do the following:
<BODY onload="countDown()" onScroll="resetCounter()" onkeypress= "resetCounter()" onclick = "resetCounter()" ondblclick = "resetCounter()" onkeydown = "resetCounter()" onkeyup="resetCounter()" onmousedown="resetCounter()" onmousemove="resetCounter()" onmouseout="resetCounter()" onmouseover="resetCounter()" onmouseup="resetCounter()" >
activity may be happening but everything times out when the parent page times out. How do I stop the timer when I am on the child page and how do I reactivate it when I exit the child page. Any help would be appreciated.
var seconds = 10;
var counter = seconds;
function countDown() {
window.status = "Session will time out in " + seconds + "seconds";
if(seconds <=0) { alert("Your session has timed out.");
window.parent.location("login.html")
}
seconds--;
window.setTimeout("countDown()",1000);
}
function resetCounter() {
seconds = counter;
}
in the body tag I do the following:
<BODY onload="countDown()" onScroll="resetCounter()" onkeypress= "resetCounter()" onclick = "resetCounter()" ondblclick = "resetCounter()" onkeydown = "resetCounter()" onkeyup="resetCounter()" onmousedown="resetCounter()" onmousemove="resetCounter()" onmouseout="resetCounter()" onmouseover="resetCounter()" onmouseup="resetCounter()" >