织梦网站做好了自定义表单后如何禁用提交按钮?禁用的表单样式怎么写?

如何30秒后可以提交?

经过测试找到了一个最简单的代码:

<!DOCTYPE html>

<head>

        <meta http-equiv=
“Content-Type” content=
“text/html; charset=utf-8”/>

        <title>js点击按钮后,倒计时N秒后才能再次点击提交</title>

</head>

<body>

        <input type=
“button” id=
“btn” value=
“免费获取验证码”/>

        <script type=
“text/javascript”>

                  var wait =
60;

                  function time(obj) {

                                           
if (wait ==
0) {

                                                    obj.removeAttribute(
“disabled”);

                                                    obj.value =
“免费获取验证码”;

                                                    wait =
60;

                                            }
else {

                                                    obj.setAttribute(
“disabled”,
true);

                                                    obj.value =
“重新发送(“ + wait +
“)”;

                                                    wait–;

                                                    setTimeout(function () {

                                                            time(obj)

                                                    },

                                                           
1000)

                                            }

                                    }

                  document.getElementById(
“btn-form1”).onclick = function () { time(
this); }

        </script>

</body>

</html>

 

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。