MASTER IN JS: Problem mit countdown

Beitrag lesen

<html>
<head>
<title>Count Down</title>
<script type="text/javascript">
hours = 6;
secs = 0;
var a = 0;
var initVal = hours * 60 + secs;
function time_counter()
{
var time = new Date();
seconds = time.getSeconds();
minutes = time.getMinutes();
secs_fin = (initVal-seconds)%60;
hours_fin = Math.floor((initVal-seconds)/60);
if (secs_fin == 0)
{
a = a+1;
initVal = (hours - 1) *60 + secs;
}
if(secs_fin <= 9)
{
document.Anzeige.Zeit.value = hours_fin +":0"+secs_fin;
}
else {
document.Anzeige.Zeit.value = hours_fin +":"+secs_fin;
}
window.setTimeout('time_counter()',1);
}
</script>
</head>
<body bgcolor="#400040" text="#FFFFFF" onLoad="time_counter();">
<form name="Anzeige" action="">
<input size="9" name="Zeit">
</form>
</body>
</html>