Question : asp count-down timer (just modification)

How should I modify the (EE-) code below to be able to show a 40min count-down clock at an asp page and, when the 40min period is finished, the user is redirected to a closing page?

Thanks,
fskilnik

EE Link:  http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_23092883.html?sfQueryTermInfo=1+10+30+asp+count+down#a20689674
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
<script>
var tId="";
var anHour = 60*60*1000;
var twoHours = anHour*2
var localTime = new Date();
var serverTime = new Date(localTime.getTime());
serverTime.setHours(17);
var diff = serverTime.getTime()-localTime.getTime();
function countDown() {
  var text = "";
  var now = new Date();
//  var gmt = new Date(now.getTime() + (now.getTimezoneOffset() * 60000));
  var serverTime = new Date(now.getTime()+diff)
  var seventeen = new Date(serverTime.getFullYear(),serverTime.getMonth(),serverTime.getDate(),17,0,0,0);
  var nineteen  = new Date(seventeen.getTime()+twoHours);
  if (serverTime>=seventeen&&serverTime<=nineteen) text += " - We are out for dinner";
 
  var millisecsUntilSeventeen =seventeen.getTime()-serverTime.getTime();
  var millisecsUntilNineteen =nineteen.getTime()-serverTime.getTime();
 
  if (millisecsUntilSeventeen<0) {
    seventeen.setDate(seventeen.getDate()+1);
  }
  var millisecsUntilSeventeen =seventeen.getTime()-serverTime.getTime();
 
  var ss = Math.floor(millisecsUntilSeventeen/1000);
  millisecsUntilSeventeen = millisecsUntilSeventeen % 1000;
  var mm = Math.floor(ss/60); 
  ss = ss % 60
  var hh = Math.floor(mm/60);
  mm = mm % 60;
  if (mm<10) mm="0"+mm
  if (ss<10) ss="0"+ss
  text = 'Countdown to 17:00: '+hh+':'+mm+':'+ss+'<br>It is '+serverTime+' - Our time<br>It is '+now+' - your time<br>'+text
  
  document.getElementById('timeSpan').innerHTML=text;
}
window.onload=function() { tId=setInterval('countDown()',1000);}
</script>
<span  id="timeSpan" style="position:fixed; top:0;left:500"></span>

Answer : asp count-down timer (just modification)

no problem, cookie is strored on the computer, if you close the browser, the cookie don't lost its value.

more info here : http://www.w3schools.com/JS/js_cookies.asp
Random Solutions  
 
programming4us programming4us