<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> </body> 手机号:<input type="text" placeholder="请输入"> <button>发送</button> <script> var btn = document.querySelector('button'); var time = 10; btn.addEventListener('click', function () { this.disabled = true; var timer = setInterval(function () { if (time == 0) { clearInterval(timer); btn.disabled = false; time = 10; btn.innerHTML = '发送'; } else { btn.innerHTML = "还剩" + time + "s"; time--; } }, 1000) }) </script> </html>