![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/b720f0e678c668c6b798064836cc202d.png)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
window.addEventListener('load', function() {
var btn = document.getElementById('number');
var send = document.getElementById('send');
var t = 3;
send.addEventListener('click', last);
function last() {
send.value = "剩余" + t + "秒";
send.disabled = "disabled";
var down = setInterval(count_down, 1000);
function count_down() {
if (t == 1) {
send.disabled = "";
send.value = "发送";
t = 3;
clearInterval(down);
console.log("over");
} else {
t--;
send.value = "剩余" + t + "秒";
send.disabled = "disabled";
}
}
}
})
</script>
</head>
<body>
<label for="">请输入您的手机号:</label>
<input type="text" id="number">
<input type="button" value="发送" id="send">
</body>
</html>