html: <a href="javascript:;" class="weui_btn weui_btn_mini weui_btn_default" id="show-notification">发送验证码</a> script: // 设定倒数秒数 var timenum = 60; // 显示倒数秒数 function showTime() { timenum = timenum - 1; if (timenum > 0) { $("#show-notification").html(timenum + "s"); $("#show-notification").attr("onclick", ""); $("#show-notification").css({ "cursor" : "default", "text-decoration" : "none", "color" : "blue" }); // 每秒执行一次,showTime() setv = setTimeout("showTime()", 1000); } else if (timenum == 0) { $("#show-notification").html("获取验证码"); $("#show-notification").attr("onclick", "sendCode()"); $("#show-notification").css({ "cursor" : "pointer", "text-decoration" : "none", "color" : "#9e9e9e" }); timenum = 60; } }