function countDown($class){ var t = $($class).attr("endTime"); var targetTime = new Date(t); targetTime = targetTime.getTime(); var nowTime = new Date(); nowTime = nowTime.getTime(); reflash($class,targetTime,nowTime);}function reflash(_class,targetTime,nowTime){ var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour * 24; var difference = targetTime - nowTime; var days = Math.floor(difference / _day); var hours = Math.floor((difference % _day) / _hour); var minutes = Math.floor((difference % _hour) / _minute); var second = Math.floor((difference % _minute)/_second); var lastTime = "<i></i>剩余"+days+"天"+nol(hours)+"时"+nol(minutes)+"分"+nol(second)+"秒"; $(_class).html(lastTime); var t = setTimeout(function(){ reflash(_class,targetTime,nowTime) },1000);}countDown($(".residual_time"))
添加回答
举报
0/150
提交
取消