那就看你怎么写两个的click事件了。 
写在两个函数中, 第一个用
obj.style.display = (obj.style.display=="none")?"":"none";
第二个就看你的了。

解决方案 »

  1.   

    stefli(激情!!!!) :
     你说的是显示和隐藏,而没有区分是button1还是button2的动作
      

  2.   

    onclick事件对应不同的函数,这有什么不好区分的?
    <input type="button" name="button1" onclick="showAndHide()"/>
    <input type="button" name="button1" onclick="modifyContent()"/>showAndHide负责显示和隐藏
    modifyContent负责修改内容,不冲突吧
      

  3.   

    <html>
    <head></head>
    <body>
    <form name="form1" method="post" action="">
      <input type="submit" name="Submit" value="提交" onClick="javascript:alert(this.name);">
    </form>
    </body></html>
      

  4.   

    可以在onclick的时候捕捉对象啊
    参考:
    <script>
    var flag_1=true;
    var object_1;
    function alertTest(obj)
    {
    if (object_1==null){
    object_1=obj;
    }
    if (obj==object_1){
    flag_1= !flag_1;
    if (flag_1)
    document.all.divTest.style.visibility="visible";
    else
    document.all.divTest.style.visibility="hidden";
    }object_1=obj;
    }</script>
        <input type="button" name="Submit4" value="按钮1" onClick="alertTest(this)">
        <input type="button" name="Submit5" value="按钮2" onClick="alertTest(this)">
    <div id="divTest" style="position:absolute;top:20;left:100; width:200px; height:115px; z-index:1; visibility: visible; background-color: #558ABF; layer-background-color: #558ABF; border: 1px none #000000;"></div>
      

  5.   

    <style>
    input{t:expression(this.onclick=function(){check(this)})};
    </style>
    <script>
    function check(obj)
    {
       if(obj.name=='button1')
         {
            //button1处理事件
         }
       if(obj.name=='button2')
         {
            //button2处理事件
         }
    }
    </script>
    <body>
    <input type='button' value='按钮' name='button1'>
    <input type='button' value='按钮' name='button2'>
    </body>
      

  6.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function cc()
    {
    var c = event.srcElement;
    var a = document.getElementById("aa"); switch(c.value)
    {
    case "button1":

    if(a.style.display=="")
    {
    a.style.display = "none";
    }
    else
    {
    a.style.display="";
    }
    break;
    case "button2":
    a.innerText = "2343";
    break;
    }}
    //-->
    </SCRIPT>
    </HEAD><BODY>
    <div id=aa style="width:100px;height:100px;border:1px solid red;">sdf</div>
    <input type=button value=button1 onclick="cc()">
    <input type=button value=button2 onclick="cc()">
    </BODY>
    </HTML>
      

  7.   

    if(event.srcElement.name=="Button1")
        alert("这是Button1的动作");
    else if(event.srcElement.name=="Button2")
        alert("这是Button2的动作");