<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <input type="button" id="btn" value="发送短信"> <script src="jquery-2.1.1.min.js"></script> <script> var count_time= 5;//定义规定的时间,60秒后再次发送 function start_timer() { if(count_time == 0) { $('#btn').removeAttr("disabled"); $('#btn').val("重新发送"); count_time= 5; }else { $('#btn').attr("disabled",true); $('#btn').val("重新发送("+count_time+")"); count_time--; setTimeout(function(){start_timer();},1000); } } $('#btn').click(function(){ start_timer(); }); </script> </body> </html>
模拟短信发送按钮
最新推荐文章于 2025-04-01 18:34:42 发布