标签:style io ar sp on cti html ef 时间
function countDown(){
var endDay,endMouse,endYear,endtime,leftsecond,day,hour,minute,second;
var nowtime = new Date();
var curHour = nowtime.getHours();
endDay = nowtime.getDate()+1;
endMouse = nowtime.getMonth();
endYear = nowtime.getFullYear();
endtime=new Date(endYear,endMouse,endDay,10,00,00);
leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000);
day=parseInt(leftsecond/3600/24);
hour=parseInt((leftsecond/3600)%24);
if(hour<10){
hour = "0"+hour;
};
minute=parseInt((leftsecond/60)%60);
if(minute<10){
minute = "0"+minute;
};
second=parseInt(leftsecond%60);
if(second<10){
second = "0"+second;
};
document.getElementById("djshour").innerHTML=hour;
document.getElementById("djsminuts").innerHTML=minute;
document.getElementById("djssecond").innerHTML=second;
if(curHour >= 10){
/*10点以后开抢的状态*/
document.getElementById("djs-id").style.display = "none";
document.getElementById("kq-cont").style.display="block";
}else{
/*时间为10点之前倒计时*/
document.getElementById("djs-id").style.display = "block";
document.getElementById("kq-cont").style.display="none";
}
}
countDown();
window.setInterval(function(){
countDown();
},1000);
标签:style io ar sp on cti html ef 时间
原文地址:http://www.cnblogs.com/ouyang2014/p/4164253.html