I think everything is good. Different from the previous code, it is worth learning.
<SCRIPT type = "text/javascript"> <! -- Var target = [] var time_id = [] function show_date_time_0 () {setTimeout ("show_date_time_0 ()", 1000); for (var I = 0, j = target. length; I <j; I ++) {today = new Date (); timeold = target [I]-today. getTime (); sectimeold = timeold/1000; secondsold = Math. floor (sectimeold); msPerDay = 24x60*60*1000; e_daysold = timeold/msPerDay; daysold = Math. floor (e_daysold); e_hrsold = (e_daysold-daysold) * 24; hrsold = Math. floor (e_hrsold); e_minsold = (e_hrsold-hrsold) * 60; minsold = Math. floor (e_hrsold-hrsold) * 60); seconds = Math. floor (e_minsold-minsold) * 60); if (daysold <0) {document. getElementById (time_id [I]). innerHTML = "expired, countdown expired";} else {if (daysold <10) {daysold = "0" + daysold} if (daysold <100) {daysold = "0" + daysold} if (hrsold <10) {hrsold = "0" + hrsold} if (minsold <10) {minsold = "0" + minsold} if (seconds <10) {seconds = "0" + seconds} if (daysold <3) {document. getElementById (time_id [I]). innerHTML = "" + daysold + "day" + hrsold + ":" + minsold + ":" + seconds + "";} else {document. getElementById (time_id [I]). innerHTML = daysold + "day" + hrsold + ":" + minsold + ":" + seconds ;}}} setTimeout ("show_date_time_0 ()", 100 ); // --> SCRIPT <p id = "TimeCounter_0" style = "border: 1px solid black; margin: 5px; padding: 2px; width: 140px "> </p> SCRIPT // sets the target time (array element) // target [target. length] = new Date (year, month-1, day, hour, minute, second ). getTime () target [target. length] = new Date ). getTime (); // set the countdown display address (array element) time_id [time_id.length] = "TimeCounter_0" SCRIPT
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]