var a = document.getElementsByTagName("INPUT");
for(var i=0; i<a.length; i++)
{
  if(a[i].type=="button") a[i].disabled = true;
}

解决方案 »

  1.   

    meizz(梅花雪)老大的代码练自己都灰化了,我改了一下....
    <html>
    <head>
    </head>
    <body>
    <input type="button" name="aa" value="aa" onclick="disButton(this)">
    <input type="button" name="bb" value="bb" onclick="disButton(this)">
    <input type="button" name="cc" value="cc" onclick="disButton(this)">
    <input type="button" name="cc" value="cc" onclick="disButton(this)">
    <input type="button" name="cc" value="cc" onclick="disButton(this)">
    <script language="javascript">
    function disButton(obj)
    {
    var a = document.getElementsByTagName("INPUT");
    for(var i=0; i<a.length; i++)
    {
      if(a[i].type=="button" && a[i]!=obj ) 
      a[i].disabled = true;
    }
    }
    </script>
    </body>
    </html>
      

  2.   

    再把狗狗的代码改一下吧:
    function disButton(obj)
    {
      var a = document.getElementsByTagName("INPUT");
      for(var i=0; i<a.length; i++)
        if(a[i].type=="button") a[i].disabled = true; 
      obj.disabled = false;
    }