<!DOCTYPE html>
<html>
<body>
<input type="button" value="点击发送" onclick="settime(this)" />
<script>
var countdown = 30;
function settime(obj) {
if (countdown === 0) {
obj.removeAttribute("disabled");
obj.value="点击发送";
countdown = 30;
return;
} else {
obj.setAttribute("disabled", true);
obj.value = "重新发送(" + countdown + ")";
countdown--;
}
setTimeout(function() {
settime(obj)
},1000)
}
</script>
</body>
</html>
06-29
07-17