为什么我这个代码不能显示啊,哪里有问题啊?
请大神帮我看看哪里有问题啊?
请大神帮我看看哪里有问题啊?
2017-04-15
lefttime 那里没有除以1000
var lefttime= parseInt((endtime.getTime() - nowtime.getTime())/1000);
=======================
完整代码:
function FreshTime()
{
var endtime=new Date("2018/10/1,12:20:12");//结束时间
var nowtime = new Date();//当前时间
var lefttime= parseInt((endtime.getTime() - nowtime.getTime())/1000);
d= parseInt(lefttime/(24*60*60)) ;
h= parseInt(lefttime/(60*60)%24);
m= parseInt(lefttime/60%60) ;
s= parseInt(lefttime%60) ;
document.getElementById("LeftTime").innerHTML=d+"天"+h+"小时"+m+"分"+s+"秒";
if(lefttime<=0){
document.getElementById("LeftTime").innerHTML="团购已结束";
clearInterval(sh);
}
}
FreshTime()
var sh;
sh = setInterval(FreshTime,500);
举报