1
2
3
4
5
6
7
8
9
10
11
12
function a(jieshu,id){
var dangqian=new Date();
var kaishi=dangqian.getFullYear()+'-'+(dangqian.getMonth()+1)+'-'+dangqian.getDate();
var jieshu1=jieshu.split("-");
var kaishi1=kaishi.split("-");
var jieshu2=jieshu1[1]+'-'+jieshu1[2]+'-'+jieshu1[0];
var kaishi2=kaishi1[1]+'-'+kaishi1[2]+'-'+kaishi1[0];
var xc=parseInt((new Date(jieshu2.replace(/-/g, "/"))-new Date(kaishi2.replace(/-/g, "/")))/24/60/60/1000);
document.getElementById(id).innerHTML=xc;
};
a("2017-05-31","divdown1");
setInterval('a("2017-05-31","sssssssss")',1000);

返回某某时间到某某时间中间剩余的时间