Javascript Countdown Timer
I wrote a little countdown timer for my wedding while waiting for stuff to compile today. It uses PHP to get itself initialized, and should be accurate as long as the server has the correct date set. Below is the basic guts of the script. You would call refreshClock() onload.
now_j = new Date();
diff = Math.ceil(now_j.valueOf()/1000) - now_p;
function refreshClock () {
now_r = new Date();
seconds = end - Math.ceil(now_r.valueOf()/1000) + diff;
document.getElementById('days').innerHTML = Math.floor(seconds/60/60/24);
document.getElementById('hours').innerHTML = Math.floor((seconds/60/60)%24);
document.getElementById('minutes').innerHTML = Math.floor((seconds/60)%60);
document.getElementById('seconds').innerHTML = seconds%60;
setTimeout("refreshClock()",1000);
}