代码
var countdown=60;
function changeflag(){
countdown=60;
}
function sendYZM(e){
//d调用发送短信接口
//
var val="发送验证码";
if (countdown == 0) {
$(e).attr("onclick", "sendYZM(this);changeflag();");
val="重新发送验证码";
clearTimeout(t);
} else {
$(e).attr("onclick", "null");
val="重新发送(" + countdown + ")";
countdown--;
};
$("#TANGRAM__PSP_3__verifyCodeResend").text(val);
t=setTimeout(function() {
sendYZM(e);
},1000);
}
jsp代码:
<span id="TANGRAM__PSP_3__verifyCodeResend" class="pass-captcha-resend" οnclick="sendYZM(this);changeflag();">发送验证码</span>