//d倒计时 function countdown(){ var show_time = document.getElementById("show_times"); endtime = new Date("03/17/2019 23:59:59");//结束时间 today = new Date();//当前时间 delta_T = endtime.getTime() - today.getTime();//时间间隔 if(delta_T < 0){ clearInterval(auto); show_time.innerHTML = "倒计时已经结束"; } window.setTimeout(countdown,1000); total_days = delta_T/(24*60*60*1000);//总天数 total_show = Math.floor(total_days);//实际显示的天数 /*total_hours = (total_days - total_show)*24;//剩余小时 hours_show = Math.floor(total_hours);//实际显示的小时数 total_minutes = (total_hours - hours_show)*60;//剩余的分钟数 minutes_show = Math.floor(total_minutes);//实际显示的分钟数 total_seconds = (total_minutes - minutes_show)*60;//剩余的分钟数 seconds_show = Math.floor(total_seconds);//实际显示的秒数*/ show_time.innerHTML = "距离展会开幕还有" + total_show + "天"; } countdown();