老师授课-3-倒计时之后点击

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 5 <title>无标题文档</title>
 6 <style>
 7 .bb
 8 {
 9     width:100px; height:40px; background-color:#0F3; border:5px double blue;}
10 
11 </style>
12 </head>
13 <body>
14 <input type="button" value="同意(10)" id="bb" disabled="disabled" />
15 </body>
16 </html>
17 <script>
18 var n =10;
19 var bb = document.getElementById("bb");
20 function bian()
21 {
22     n--;
23     if(n==0)
24     {
25         bb.removeAttribute("disabled");
26         bb.value="同意";    
27     }
28     else
29     {
30         bb.value="同意("+n+"";    
31         window.setTimeout("bian()",1000);
32     }    
33 }
34 window.setTimeout("bian()",1000);
35 
36 </script>

运行

posted @ 2016-05-25 19:56  右掱写爱  阅读(118)  评论(0编辑  收藏  举报