jquery倒计时

//倒计时

    function countDown(){

        var endTime=new Date("2015/7/1 00:00:00").getTime();

        var nowTime=new Date().getTime();

        var t=endTime-nowTime;

        var d=Math.floor(t/1000/60/60/24);

        var h=Math.floor(t/1000/60/60%24);

        var m=Math.floor(t/1000/60%60);

        var s=Math.floor(t/1000%60);

        $(".t_d").html(d);

        $(".t_h").html(h);

        $(".t_m").html(m);

        $(".t_s").html(s);

    }

    setInterval(countDown,1000);

 

你可能感兴趣的:(jquery)