DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> jQuery入門知識 >> JQuery特效代碼 >> JQuery實現倒計時按鈕具體方法
JQuery實現倒計時按鈕具體方法
編輯:JQuery特效代碼     

. 代碼如下:
<head>
    <title>test count down button</title>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#btn').click(function () {
                var count = 3;
                var countdown = setInterval(CountDown, 1000);

                function CountDown() {
                    $("#btn").attr("disabled", true);
                    $("#btn").val("Please wait " + count + " seconds!");
                    if (count == 0) {
                        $("#btn").val("Submit").removeAttr("disabled");
                        clearInterval(countdown);
                    }
                    count--;
                }
            })

        });
   </script>
</head>
<body>
<input type="button" id="btn" value="Submit" />
</body>

有興趣您可以自己實現一下。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved