The effect is as follows:
1 <Divclass= "Warp">2 <PID= "txt">Distance to "11" National Day holiday also:</P><BR>3 <PID= "Time"></P>4 </Div>
JavaScript Source code:
1<script>2$ (document). Ready (function(e) {3 4 functiontimer ()5 {6 //Get system Current time7 varseconds;8 varminutes;9 varhours;Ten varDays ; One varYear ; A varmouth; - - varDate =NewDate (); theseconds =date.getseconds (); -minutes =date.getminutes (); -Hours =date.gethours (); -Year =date.getfullyear (); +mouth = Date.getmonth () +1; -Days =date.getdate (); + A //because date gets the current time month is 0-11, less than one months, so you need to get to each time, redefine the current time at varShiyi =NewDate (2015,10,1,0,0,0); - varNowdate =NewDate (year,mouth,days,hours,minutes,seconds); - - varShiyitime =shiyi.gettime (); - varNowtime =nowdate.gettime (); - in varCTime = Shiyitime-Nowtime; - varCDD = Checktime (parseint (ctime/(1000*60*60*24), 10)); to varCHH = Checktime (parseint (ctime/1000/60/60%24,10)); + varCMM = Checktime (parseint (ctime/1000/60%60,10)); - varCSS = Checktime (parseint (ctime/1000%60,10)); the * functionchecktime (i) $ {Panax Notoginseng if(I < 10) - { thei = "0" +i; + } A returni; the } + -document.getElementById ("Time"). InnerHTML = cdd+ "Days" +chh+ "+cmm+" minutes "+css+" seconds "; $ } $SetInterval (timer,1000); - - }); the</script>
Use JavaScript for a simple countdown function