方法一:jquery实现发送短信验证码后60秒倒计时
<!DOCTYPE html>
<html lang="en"><head> <meta charset="UTF-8"> <script src="js/jquery-3.2.1.min.js"></script> <title>666</title></head><body> <input type="button" id="btn" value="获取验证码"/><script>
$(function () { $('#btn').click(function () { var count = 60; var countdown = setInterval(CountDown, 1000); function CountDown() { $("#btn").attr("disabled", true); $("#btn").val("重新发送("+count +")"); if (count == 0) { $("#btn").val("获取验证码").removeAttr("disabled"); clearInterval(countdown); } count--; } }) }); </script></body></html>