You are here: irt.org | FAQ | JavaScript | Date | Q1204 [ previous next ]
Try:
<script language="JavaScript"><!-- var y2kms = (new Date(2000,0,1,0,0,0)).getTime(); function tick() { var nowms = (new Date()).getTime(); var temp; if (y2kms > nowms) { temp = Math.floor((y2kms - nowms)/1000); if (document.myForm.myCount.value != temp) document.myForm.myCount.value = temp; setTimeout('tick()',500); } else alert('BANG!'); } //--></script> <body onLoad="tick()"> <form name="myForm"> <input type="text" name="myCount"> </form>