Home  >  Article  >  Web Front-end  >  How to restore button click functionality using JS countdown

How to restore button click functionality using JS countdown

php中世界最好的语言
php中世界最好的语言Original
2018-06-02 15:59:032525browse

This time I will show you how to use the JS countdown recovery button click function, and what are the precautions for using the JS countdown recovery button click function. The following is a practical case, let's take a look.

After the countdown time is up, click the restore button, which is often used to read the agreement:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>阅读协议倒计时</title>
    <script>
      var tim=9;
      function aaa(){
        var btnn=document.getElementById("btn");
        if(tim<=0)
        {
          btnn.value="注册";
          btnn.disabled="";
        }
        else
        {
          btnn.value="请仔细阅读,还剩"  +tim+"秒";
          tim--;
        }
      }
      setInterval("aaa()",1000);
    </script>
  </head>
  <body>
    <textarea style="width: 500px;height: 300px;">
    </textarea>
    <input type="button" id="btn" value="请仔细阅读,还剩10秒" disabled="disabled" />
  </body>
</html>

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

How to use Vue to implement a countdown button

How to use Vue to write a two-way data binding

The above is the detailed content of How to restore button click functionality using JS countdown. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn