<input type="button" onclick="this.disabled=true;thisformsubmit();" />

解决方案 »

  1.   

    <input  value="111111"  type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change1()" /><script>
    function change(e){
    e.disabled="disabled"
    }
    function change1(){
    document.getElementsByTagName("input")[0].disabled=""
    }
    </script>
      

  2.   

    看错要求了
    <input  value="111111"  type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" /><script>
    var oo=true
    function change(e){
    if(oo==true)
    {e.disabled="disabled";
    oo=false
    e.id="ss"
    }
    else
    {
    document.getElementById("ss").disabled=""
    oo=true
    }
    }
    </script>
      

  3.   

    <input id="a1"  value="111111"  type="button" onclick="change(this.id)" /> 
    <input id="a2"   value="222222" type="button" onclick="change(this.id)" /> <script> 
    var objid;
    function change(e){ 
    e.disabled="disabled" ;
    objid=e;
    objid.disabled="" ;

    </script>
      

  4.   

    <input id="a1"  value="111111"  type="button" onclick="change(this.id)" /> 
    <input id="a2"   value="222222" type="button" onclick="change(this.id)" /> <script> 
    var objid;
    function change(e){ 
    document.getElementById(e).disabled="disabled" ;
    objid=e;
    document.getElementById(objid).disabled="" ;

    </script>
      

  5.   

    <script>
    function test(obj){
    for( var i=1;i<=2;i++ ){
    document.getElementById("button"+i).disabled=false;
    if( obj == document.getElementById("button"+i) )
    obj.disabled = true;
    }
    }
    </script>
     <input type="button" id="button1" value="ok1" onclick="test(this);">
     <input type="button" id="button2" value="ok2" onclick="test(this);">
      

  6.   

    给你点建议,如果比较多的按钮怎么办?
    难道你也都用FOR循环??都要遍历一遍?
      

  7.   

    <input id="a1"  value="111111"  type="button" onclick="change(this.id)" /> 
    <input id="a2"   value="222222" type="button" onclick="change(this.id)" /> 
    <script> 
    var objid;
    function change(e){ 
    document.getElementById(e).disabled="disabled" ;
    if(objid){
    document.getElementById(objid).disabled="" ;}
    objid=e;

    </script>
    这个应该比较全面了
      

  8.   

    <input  value="111111"  type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" /><script>
    var oo=true
    function change(e){
    if(oo==true)
    {e.disabled="disabled";
    oo=false
    e.id="ss"
    }
    else
    {
    document.getElementById("ss").disabled=""
    document.getElementById("ss").id=""
    oo=true
    }
    }
    </script>
    随手写的 bug多多 呵呵!!
      

  9.   

    <script> 
    var tmpObj;
    function test(obj){ 
    obj.disabled = true;
    if(tmpObj)tmpObj.disabled = false;
    tmpObj = obj;

    </script> 
    <input type="button" id="button1" value="ok1" onclick="test(this);"> 
    <input type="button" id="button2" value="ok2" onclick="test(this);">
    <input type="button" id="button3" value="ok3" onclick="test(this);">
      

  10.   

    你的还是有问题oo=false了你再按按钮的时候根本无法执行
    if(oo==true)
    {e.disabled="disabled";
    oo=false
    e.id="ss"
    }
    这部分
      

  11.   

    恩 没仔细看需求
    <input  value="111111"  type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" /><input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" />
    <input value="222222" type="button" onclick="change(this)" /><script>
    function change(e){
    if(document.getElementById("ss")!=null)
    {document.getElementById("ss").disabled=""
    document.getElementById("ss").id=""}
    e.disabled="disabled";
    e.id="ss"}
    </script>
      

  12.   

    其实一个全局变量就解决问题了,哪里需要循环啊 
    <html>
       <head>
    <script type="text/javascript">
    var num=0;
    function cl(e,id){
        e.disabled="disabled";
        if(num){
    document.getElementById(num).disabled="";
        }
        num=id;
    }
    </script>
      </head>
      
      <body>
        This is my HTML page. <br>
        <input type="button" value="button1" id="b1" onclick="cl(this,'b1')"/>
        <input type="button" value="button2" id="b2" onclick="cl(this,'b2')"/>
        <input type="button" value="button3" id="b3" onclick="cl(this,'b3')"/>
        <input type="button" value="button4" id="b4" onclick="cl(this,'b4')"/>
        <input type="button" value="button5" id="b5" onclick="cl(this,'b5')"/>
        <input type="button" value="button6" id="b6" onclick="cl(this,'b6')"/>
        <input type="button" value="button7" id="b7" onclick="cl(this,'b7')"/>
      </body>
    </html>
      

  13.   

    谢谢大家的帮忙,尤其要谢谢chinmo ,呵呵