倒计时样式


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);

posted @ 2014-12-15 10:18  誰舆徴夆  阅读(273)  评论(0编辑  收藏  举报