js 计时显示 倒着 正者 都行
//倒计时显示 function leftTimer(year,month,day,hour,minute,second){ var leftTime = (new Date(year,month-1,day,hour,minute,second)) - (new Date()); //计算剩余的毫秒数 var days = parseInt(leftTime / 1000 / 60 / 60 / 24 , 10); //计算剩余的天数 var hours = parseInt(leftTime / 1000 / 60 / 60 % 24 , 10); //计算剩余的小时 var minutes = parseInt(leftTime / 1000 / 60 % 60, 10);//计算剩余的分钟 var seconds = parseInt(leftTime / 1000 % 60, 10);//计算剩余的秒数 days = checkTime(days); hours = checkTime(hours); minutes = checkTime(minutes); seconds = checkTime(seconds); setInterval("leftTimer(<?=date('Y',$cbtimes)?>,<?=date('m',$cbtimes)?>,<?=date('d',$cbtimes)?>,<?=date('H',$cbtimes)?>,<?=date('i',$cbtimes)?>,<?=date('s',$cbtimes)?>)",1000); document.getElementById("cuiban").innerHTML = '剩余时间: '+days+"天" + hours+"小时" + minutes+"分"+seconds+"秒"; } function checkTime(i){ //将0-9的数字前面加上0,例1变为01 if(i<10) { i = "0" + i; } return i; }