熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

Jquery倒數計時按鈕setTimeout的實例代碼

2022-06-13   來源: JSP教程 
這篇文章介紹了Jquery倒數計時按鈕setTimeout的實例有需要的朋友可以參考一下   復制代碼 代碼如下:
<head runat="server">
    <title></title>
    <script type="text/javascript" src="js/jqueryjs"></script>
    <script type="text/javascript">
        var timeout;
        var count = ; // 倒數十下
        $(function() {
            timeout = setTimeout(BtnCount ); // s執行一次BtnCount
        });
        BtnCount = function() {
               // 啟動按鈕
               if (count == ) {
                $(#btnSubmit)attr("disabled" "");
                $(#btnSubmit)val("確定");
                clearTimeout(timeout);           // 可取消由 setTimeout() 方法設置的 timeout
            }
            else {
                count;
                $(#btnSubmit)val("確(" + counttoString() + ")定");
                setTimeout(BtnCount );
            }
        };
    </script>
</head>
<body>
    <form id="form" runat="server">
    <div>
        <asp:Button ID="btnSubmit" runat="server" Text="確定" Enabled="false"
            onclick="btnSubmit_Click"/>
    </div>
    </form>
</body>

  
setTimeout預設只執行一次但我們可以用遞歸是它自己啟動自己


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20387.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.