<!DOCTYPE HTML><HTML><Head> <MetaCharSet= "Utf-8"> <title>JS Implementation countdown (hours, minutes, seconds)</title> <Script> functionShowcountdown (year,month,day,divname) {var Now= NewDate (); varendDate= NewDate (year, month, day); varLefttime=enddate.gettime ()-Now.gettime (); varDD=parseint (Lefttime/ + / - / - / -, Ten);//calculate the number of days remaining varhh=parseint (Lefttime/ + / - / - % -, Ten);//calculate the number of hours remaining varmm=parseint (Lefttime/ + / - % -, Ten);//calculate the number of minutes remaining varSS=parseint (Lefttime/ + % -, Ten);//calculate the number of seconds remainingDD=Checktime (DD); HH=checktime (HH); MM=checktime (mm); SS=Checktime (ss);//less than 10 plus 0. varcc=document.getElementById (divname); Cc.innerhtml= "Distance" + Year+ "years" +Month+ "Month" + Day+ "The Day also has:" +DD+ "days" +hh+ "hours" +mm+ "points" +SS+ "seconds"; } functionChecktime (i) {if(i< Ten) {i= "0" +i; } returni; } window.setinterval (function() {Showcountdown (2020, One, One,'Countdown');}, +); </Script></Head><Body><DivID= "Countdown"></Div></Body></HTML>
JS Learning Note Date countdown (days, hours, minutes, seconds)