标签:计时器
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>计时器</title> </head> <body> <button id="setTime">免费发送短信</button> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript"> var time=10; $(document).ready(function(){ $("#setTime").click(function(){ $(this).attr("disabled","disabled"); var span="秒后免费发送短信"; $(this).html(time+span); var t=setInterval(function(){ time=time-1; if(time==0){ $("#setTime").html("免费发送短信"); $("#setTime").removeAttr("disabled"); time=10; clearInterval(t); }else{ $("#setTime").html(time+span); } },1000) }) }) </script> </body> </html>
标签:计时器
原文地址:http://zhiaidql.blog.51cto.com/6965969/1585153