Hi everyone,

I need 100-120 sec delay on my web page. I found a countdown script –attached, which works fine. The problem with this script is, that when you leave the page and then come back it starts countdown all over again. I need the counter refresh itself only if you close the browser otherwise it must remember its state. How can I do this with JavaScript, PHP and HTML? Any suggestions?



Code JavaScript:
<html>
<head>
....
<script language="javascript">
function afterDelay() {
....
}
</script> 
</head>
 
<body>
 
<form name="redirect">
You will be redirected in
<input  type="text" size="1" name="redirect2">
</form>
seconds
 
<script type="text/javascript">
<!--
var countdownfrom=5 
var currentsecond=document.redirect.redirect2.value=countdownfrom+1
function countredirect(){
if (currentsecond!=0){
currentsecond-=1
document.redirect.redirect2.value=currentsecond
}
else{
afterDelay()
return
}
setTimeout("countredirect()",1000)
}
countredirect()
//-->
</script> 			
</body>
</html>