Joke Collection Website - Blessing messages - JS countdown, how much time is left before a certain date?

JS countdown, how much time is left before a certain date?

Effect:

The code is as follows:

& lt span? Id = "show"> loading ... & lt/span>.

& lt script? type = " text/JavaScript " & gt;

//time_val? Compare time? Format: 2016-12-14? 22:55:40

Function? Countdown (time value) {

var? www_qsyz_net=/^[\d]{4}-[\d]{ 1,2}-[\d]{ 1,2}(? [\d]{ 1,2}:[\d]{ 1,2}(:[\d]{ 1,2})? )? $/ig,str= ' ',conn,s;

If (! time_val.match(www_qsyz_net)){

Alert ('parameter format is 2012-01-01[? 01:01[:01]]. \ r [] can be omitted');

Return? Fake;

}

var? Sec= (new? Date(time_val.replace(/-/ig,'/'))。 getTime()? -? New? Date (). getTime())/ 1000;

If (seconds? & gt? 0){

conn= '? "Then what?";

} Otherwise {

conn= '? "Has it passed?";

sec * =- 1;

}

S={' days': sec/24/3600,' hours': sec/3600%24,' minutes': sec/60%60,' seconds ':sec % 60 };

For (me? Are you online? s){

if(math . floor(s[I])& gt; 0? )? str? +=? Math.floor(s[i])? +? Me;

}

if(Math.floor(sec)==0){? Str = "0 seconds"; ? }

document.getElementById('show ')。 innerHTML? =? Distance? & ltu & gt? +? time_val? +? '& lt/u & gt; ? +? Kang En? +' & lt; u & gt? +? str? +? '& lt/u & gt; ;

//Update once every second

setTimeout(function(){ count down(time _ val)}, 1000);

}

Countdown ('2016-12-14? 22:55:40');

& lt/script & gt;