All pastes #237037 Raw Edit

Untitled

public javascript v1 · immutable
·published 2006-11-04 08:25 UTC
rendered paste body
function countdown(untilDate, dispElement, finalMessage) {	var theDate = Date.parse(untilDate);	var theElement = document.getElementById(dispElement);	var now = Date.parse((new Date()).toString());	var dd, dday, dhour, dmin, dsec	dd = theDate - now;	if (dd <= 0) {		theElement.innerHTML = finalMessage;	} else {		dday = Math.floor(dd/(60*60*1000*24)*1);		dhour = Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);		dmin = Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);		dsec = Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);		theElement.innerHTML = dday + ":" + dhour + ":" + dmin + ":" + dsec;	}	setTimeout("countdown('" + untilDate + "','" + dispElement + "','" + finalMessage + "');", 1000);}countdown('11/1/2006', 'test', 'it is here.');