xastax: JS Countdown

Beitrag lesen

So ich hab es geschafft! Für die die es interessiert folgt der Code.
Danke für die Antworten.

mfg
xastax

<script type='text/javascript'>
var end = new Date('"Fest Zeit eintragen"');
var timestamp; <?php echo "timestamp = " . (mktime() * 1000); ?>

function toSt2(n) {
  s = '';
  if (n < 10) s += '0';
  return (s + n).toString();
}
function toSt3(n) {
  s = '';
  if (n < 10) s += '00';
  else if (n < 100) s += '0';
  return (s + n).toString();
}
function countdown() {
  var   d = new Date(timestamp);
  count = Math.floor(end.getTime() - d.getTime());
  if(count > 0) {
    miliseconds = toSt3(count%1000); count = Math.floor(count/1000);
    seconds = toSt2(count%60); count = Math.floor(count/60);
    minutes = toSt2(count%60); count = Math.floor(count/60);
    hours = toSt2(count%24); count = Math.floor(count/24);
    days = count;
    timestamp += 1000;

document.getElementById('c1').innerHTML  = days + ' TAGE';
    document.getElementById('c2').innerHTML  = hours + ':' + minutes + ':' + seconds

setTimeout('countdown()', 1000);
  }
}
</script>