请问这样的JS如何写?谢谢大伙

解决方案 »

  1.   


    <!doctype html>
    <html>
    <head>
    <meta charset="gb2312" />
    <title></title>
    <style>
    </style>
    </head>
    <body>
    <button id="test">test</button>
    <script>
    function $(o){return document.getElementById(o)}

    $('test').onclick = function(){
    alert('test');
    this.disabled = true;
    setTimeout(fn, 2000);
    }
    function fn(){
    $('test').disabled = false;
    }
    </script>
    </body>
    </html>楼主 这个意思?
      

  2.   

    楼上的是可以,不过,你最好用按扭。button.这样禁用了才不可以点。用a标签禁用了还可以点。
      

  3.   


    <input type="button" onclick="disButton(this)" value="click me">function disButton(self){
    self.disabled = true;
    setTimeout(function(){
    self.disabled = false;
    }, 5000)
    }
      

  4.   

    setTimeout设置延迟了之后,照样能点击,只是没反应而已