js 倒计时 button不可用

  

 1  function showtime() {
 2             fun_timedown(5);
 3         }
 4         function fun_timedown(time) {
 5             $("#timedown").val(time + "秒");
 6             time = time - 1;
 7             if (time >= 0) {
 8                 $("#timedown").attr("disabled", "disabled");
 9                 setTimeout("fun_timedown(" + time + ")", 1000);
10             
11             } else {
12 
13                 alert('倒计时结束啦');
14 
15             }
16         }
1 <input type="button" id="timedown" value="确定"/>
2  <a href="javascript:showtime()">点击</a>

 

posted @ 2014-03-23 11:07  张三的编码生活  阅读(275)  评论(0编辑  收藏  举报