短信控制60秒重新发送

    xiaoxiao2024-12-25  12

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Document</title> </head> <body> <form action=""> <input type="text" value="请输入手机号码" /> <input id="btn" οnclick="settime(this)" type="submit" value="接收短信" /> </form> </body> <script type="text/javascript">  var countdown=60;  function settime(obj) {      if (countdown == 0) {          obj.removeAttribute("disabled");             obj.value="免费获取验证码";          countdown = 60;          return;     } else {          obj.setAttribute("disabled", true);          obj.value="重新发送(" + countdown + ")";          countdown--;      }  setTimeout(function() {      settime(obj) }     ,1000)  } </script> </html>
    转载请注明原文地址: https://ju.6miu.com/read-1294977.html
    最新回复(0)