首页 新闻 会员 周边 捐助

jquery 倒计时!急 急 (在线等)

0
悬赏园豆:20 [已关闭问题] 关闭于 2009-06-11 21:07

<script language="javascript" type="text/javascript">
        var Time;
        var MyServerTime;
       
        $(function() {
            GetServerTime();
        });
        //获得服务器时间和设置当前期号
        function GetServerTime() {
            var rand = Math.random();
            $.get("getservertime/getime.aspx?radn=" + rand, { Action: "get", Name: "lulu" }, function(data, textStatus) {
                this;
                NowServerTime(data);
            });

        }

        function NowServerTime(data) {
            Time = data;
            ServerTimeCode();
        }

        function ServerTimeCode() {

            var Rowdata = "2009-6-12 20:50:00"
            var ServerTime = new Date(Date.parse(Time.replace(/-/g, "/")));
            var NowTime = new Date(Date.parse(Rowdata.replace(/-/g, "/")));
            MyServerTime = NowTime - ServerTime;
            alert(MyServerTime);
            Delete();
        }

        function Delete() {
            MyServerTime--;
            var nH = Math.floor(MyServerTime / (1000 * 60 * 60)) % 24; //得到多少小时
            var nM = Math.floor(MyServerTime / (1000 * 60)) % 60; //得到多少分钟
            var nS = Math.floor(MyServerTime / 1000) % 60; //得到多少秒
            var strTime = "";
            if (MyServerTime > 0) {
                if (nH >= 10) {
                    strTime = strTime + nH;
                }
                else {
                    strTime = strTime + "0" + nH;
                }
                if (nM >= 10) {
                    strTime = strTime + ":" + nM;
                }
                else {
                    strTime = strTime + ":0" + nM;
                }
                if (nS >= 10) {
                    strTime = strTime + ":" + nS;
                }
                else {
                    strTime = strTime + ":0" + nS;
                }
                $("#divTime").html(strTime);
            }
            else {
                alert("时间到!");
           
            }

            setTimeout(Delete, 1000);
        }

 

我这样写 时间是出来了 但是秒不能动!高手帮我看看 我要实现服务器倒计时

问题补充: 呵呵已经自己搞定了 算法问题!
烈焰_闹闹的主页 烈焰_闹闹 | 初学一级 | 园豆:65
提问于:2009-06-11 20:29
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册