日期:2014-05-16 浏览次数:20393 次
var dt = new Date(), hour = dt.getHours(),date = dt.getDay(); var end = new Date(dt.getYear(),dt,getMonth(),date,12) //活动结束时间 var diff = end - dt; var timer = setInterval(function(){ if(dt > 0 && hour > 10){ //hour > 10 活动开始时间 //do something }else{ //do something clearInterval(timer); } diff -= 1000; //timer 1sec },1000)