I’m in need for a count up script that counts from a specific date since the last incident. I got a fairly easy script working but I need a function that reset the date or if possible, set the date manually directly from the webpage. Is this possible? Here is the script im using right now.
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
#timer {
width:430px;
line-height:40px;
border:3px double #999;
font-family:verdana,arial,helvetica,sans-serif;
font-size:1em;
text-align:center;
margin:40px auto;
}
</style>
<script type="text/javascript">
window.onload=function() {
doTime();
}
function doTime() {
now=new Date ();
then=new Date ('feb,06,2014,22:31:00');
difference=(now-then);
days=Math.floor(difference/(60*60*1000*24)*1);
hours=Math.floor((difference%(60*60*1000*24))/(60*60*1000)*1);
mins=Math.floor(((difference%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
secs=Math.floor((((difference%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
document.getElementById('timer').firstChild.nodeValue=
'Det er nå '+days+' dager '+hours+' timer '+mins+' minutter '+secs+' sekunder siden siste beredskapshendelse';
setTimeout('doTime()',1000);
}
</script>
</head>
<body>
<div id="timer"> </div>
</body>
</html>