/*Countdown*/varDowntime =function (endtime,obj,callback) {/*Basic Judgment*/ if(!endtime | |typeofEndTime!=="string")return false; /*Basic Judgment*/ if(!obj | |typeofObj!=="Object")return false; /*gets the milliseconds of the date*/ varEndTime =Date.parse (endTime); /*Timer*/setinterval (function () {varNowtime = +NewDate (); /*2 time difference milliseconds*/ varMinus =endtime-Nowtime; /*Days of difference*/ varDay = parseint (minus/ +/ -/ -/ -); /*Hours of difference*/ varHours = parseint (minus/ +/ -/ -% -); /*minute of difference*/ varMintue = parseint (minus/ +/ -% -); /*gets the difference in seconds*/ varSecond = parseint (minus/ +% -); obj[0].innerhtml = parseint (hours/Ten); obj[1].innerhtml = hours%Ten; obj[3].innerhtml = parseint (mintue/Ten); obj[4].innerhtml = mintue%Ten; obj[6].innerhtml = parseint (second/Ten); obj[7].innerhtml = second%Ten; }, +); Callback&&callback ();};
JS for a simple countdown