<script language="javascript" type="text/javascript"> var interval = 1000; function toDb(n){ if(n<10){ return ‘0‘+n; } else { return ‘‘+n; } }; function ShowCountDown(year,month,day,divname) { var now = new Date(); var endDate = new Date(year, month-1, day); var leftTime=endDate.getTime()-now.getTime(); var leftsecond = parseInt(leftTime/1000); var day1=toDb(Math.floor(leftsecond/(60*60*24))); var hour=toDb(Math.floor((leftsecond-day1*24*60*60)/3600)); var minute=toDb(Math.floor((leftsecond-day1*24*60*60-hour*3600)/60)); var second=toDb(Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60)); var cc = document.getElementById(divname); cc.innerHTML = "距离活动结束,仅剩下 <span class=‘red‘>"+day1+"</span>天 <span class=‘red‘>"+hour+"</span>时 <span class=‘red‘>"+minute+"</span>分 <span class=‘red‘>"+second+"</span>秒"; }; window.setInterval(function(){ShowCountDown(2016,10,15,‘lastTime‘);}, interval); </script>
时间: 2024-10-10 07:10:04