Time to get verification code

var wait=60;
function getCode(){
var codeBtn = document.getElementById("codeBtn");
codeBtn.style.border="none";
codeBtn.style.fontSize="12px";
codeBtn.style.color="#9C9C9C";
codeBtn.value=wait+"秒后重新获取";
time(codeBtn);
$.ajax({
url:'${ctx}/statics!phoneMessage.json',
type:'POST',
data:{toolMessage:document.getElementById("phone").value},
async:false,
success:function(result){
code=result;
}
});
}
function time(o) {
if (wait == 0) {
o.value="获取验证码";
o.style.border="1px";
o.style.fontSize="14px";
o.style.color="black";
wait = 60;
} else {
o.value= wait + "秒后重新获取";
wait--;
setTimeout(
function() {
time(o)
},1000)
}
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327082187&siteId=291194637