JS 发送短信验证码


var countSecond = 60;//秒数 function settime() { if (countSecond == 0) { $(".cell-btn").css("background-color", "");//按钮变为原来的颜色(这个按钮原来没有颜色) $(".cell-btn").attr("disabled", false);//启用按钮 $(".cell-btn").text("获取验证码"); countSecond = 60; return false; } else { $(".cell-btn").css("background-color", "#c0c0c0");//改变按钮颜色(灰色) $(".cell-btn").attr("disabled", true);//禁用按钮 $(".cell-btn").text("重新发送(" + countSecond + ")"); countSecond--; } setTimeout(function () { settime(); }, 1000); }

以上是页面的动画效果,60秒一次

后台 存数据,调短信接口的代码我就不写了。 

原文地址:https://www.cnblogs.com/liuzheng0612/p/11692244.html