zoukankan      html  css  js  c++  java
  • js实现等待n秒后按钮可用

    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
        <script type="text/javascript">
            var count = 10;
           var tmrid= setInterval("setvalue()", 1000);
            event.cancelBubble=true
            function setvalue()
            {
                var btn = document.getElementById("btn");
                if (count > 0) {
                    btn.value = "等待" + count + "秒";
                    count--;
                    btn.disabled = true;
                }
                else {
                    btn.value = "同意"
                    clearInterval("tmrid");
                    btn.disabled = false;
                }
            }
    
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <input id="btn" type="button" value="同意" />
        </div>
        </form>
    </body>
    </html>
    

      

  • 相关阅读:
    溢出省略号
    自定义字体
    jquery实现上一页下一页
    集成学习理解
    常用命令-python篇
    python 多进程和多线程
    10预处理命令上
    9函数
    8指针2
    7指针1
  • 原文地址:https://www.cnblogs.com/anbylau2130/p/3128691.html
Copyright © 2011-2022 走看看