<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> var c = 3; var t; function timedCount() { document.getElementById('txt').value = c c = c - 1 if (c == 0) { alert("asdf"); } else { t = setTimeout("timedCount()", 1000); } } </script> </head> <body> <form id="form1" runat="server"> <input type="button" value="Start count!" οnclick="timedCount()" /> <input type="text" id="txt" /> </form> </body> </html>
简单的JS实现按钮触发倒计时功能
最新推荐文章于 2021-11-29 09:17:59 发布