js练习1(十秒钟阅读效果)

<html>
    <head>
        <title>10秒钟阅读协议效果</title>
    </head>
    <body>
        <input type="button" name="btn" value=""  id="btn"  />
        <script>
            var n=10;
            var time;
            var b=document.getElementById("btn");
            b.disabled=true;
            b.style.width=50;
            
            function change(){
                b.value=n;
                n--;
                if(n<0){
                    b.value="同意";
                    b.disabled=false;
                    clearInterval(time);
                }
            }
            time=setInterval("change()",1000);
        </script>
    </body>
</html>

 

posted @ 2013-01-22 09:49  天道酬勤,坚持!  阅读(330)  评论(0编辑  收藏  举报