- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Document</title>
- </head>
- <body>
- <button id="getPhoneCode"></button>
- <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
- <script>
- function settime($obj,time){
- if(time==0){
- $obj.attr("disabled",false);
- $obj.css("background","#f38401").css("cursor","pointer");
- $obj.text("获取手机验证码");
- return;
- }else{
- $obj.attr("disabled",true);
- $obj.css("background","#ccc").css("cursor","noe-allowed");
- $obj.text("重新发送("+time+")");
- time--;
- }
- setTimeout(function(){settime($obj,time)},1000);
- }
- settime($("#getPhoneCode"),60);
- </script>
- </body>
- </html>
posted @
2017-08-24 10:46
\面朝阳光/
阅读(
274)
评论()
编辑
收藏
举报