码迷,mamicode.com
首页 > 其他好文 > 详细

倒计时样式

时间:2014-12-15 11:49:41      阅读:153      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!