一个button按钮    比如叫“添加”点击“添加”的时候按钮变成“移出”   点击移出的时候再变成“添加”怎么实现的   = =~~~!

解决方案 »

  1.   

    如id="MyBotton"点击事件里写if(MyBotton.Text=="添加")
    {
        MyBotton.Text=="移出"
    }
    else if(MyBotton.Text=="移出")
    {
        MyBotton.Text=="添加"
    }
      

  2.   

    private void Button1_Click(object sender, EventArgs e)
    {
         if(Button1.Text=="添加")
         {
              Button1.Text="移出";
         }
         else
         {
              Button1.Text="添加";
         }
    }
      

  3.   

    使用js 更高效:
    <input id="Button1" type="button" value="添加" onclick="document.getElementById('Button1').value=='添加'?document.getElementById('Button1').value='移出':document.getElementById('Button1').value='添加';" />