js 高考倒计时

  var timedate = new Date("June 7,2013");    
    var times = "2013年高考";    
    var now = new Date();    
    var date = timedate.getTime() - now.getTime();    
    var time = Math.floor(date / (1000 * 60 * 60 * 24)) + 1;
    
    var s_time = String(time);
    var s_time_leng = s_time.length;
    
    if(s_time_leng == 2){
        $("#time1").addClass("time" + s_time.substr(0,1));
        $("#time2").addClass("time" + s_time.substr(1,1));
    }
    else if(s_time_leng == 1){
        $("#time2").addClass("time" + s_time.substr(0,1));
    }

posted @ 2014-01-08 09:59  kwishly  阅读(799)  评论(0编辑  收藏  举报