<script>
var flag=1;
function switch_fun()
{
if(flag=1)
  open();
else
  close();
}
</script>
<input onclick="switch_fun()">

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>无标题文档</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <SCRIPT language=JavaScript>function Open(mode){
    var dis1 = document.getElementById('dis1');
    var dis2 = document.getElementById('dis2');
    dis1.style.display = 'none';
    dis2.style.display = 'none';
    //alert(mode);
        if(0==mode){
        dis2.style.display = "";
        }
        if(1==mode){
        dis1.style.display = "";
        }
    alert("1");
    return true;

    }
    function Close(mode){
    var dis1 = document.getElementById('dis1');
    var dis2 = document.getElementById('dis2');
    dis1.style.display = 'none';
    dis2.style.display = 'none';
    //alert(mode);
        if(0==mode){
        dis2.style.display = "";
        }
        if(1==mode){
        dis1.style.display = "";
        }
    alert("2");
    return true;

    }
    </script></head> 
    <BODY onload=Open(0)>
    <form><table>
       <tr height=22 >
         <td colspan=3 id=dis1 style="display: "><input name=submit_relay type=button onclick=Open(0)    value=提交 >              </td>
                 <td colspan=3 id=dis2 style="display: ">  <input name=submit_server type=button onclick=Close(1)   value=提交 >
                   </td>
    </tr>
       </table>
    </form>
    </body>
    </html>
      

  2.   

    <script>
    var flag=1;
    function switch_fun()
    {
    if(flag==1)
      open();
      flag=0;
    else
      close();
    }
    </script>
    <input onclick="switch_fun()">
      

  3.   

    <body>
    <input type="button" value="open" onclick="javascript:if(this.value=='open'){ this.value='close';alert('open');}else{this.value='open'; alert('close');}"> 
    </body>