<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>One</title>
</head>
<body>
<input type="button" id="btn" value="发送验证码" onclick="OneTime(this)"/>
<script>
var cunt = 60;
function OneTime(val) {
if (cunt == 0){
val.removeAttribute("disabled")
val.value = "发送验证码"
cunt = 60;
} else {
val.setAttribute("disabled",true)
val.value = "请重新发送( "+ cunt +" )";
cunt--;
setTimeout(function () {
OneTime(val)
},1000)
}
}
</script>
</body>
</html>