我在网页中放了有多个button,我想实现当鼠标放到该按钮(服务器控件)上时改变该button的背景色和字体的颜色,还有,怎么让该button变成透明的状态显示.

解决方案 »

  1.   

    背景以及字体         
       Button1.Attributes.Add("onmouseover", "d=this.style.backgroundColor;this.style.BackColor='red';c=this.style.color;this.style.color='blue'");
                Button1.Attributes.Add("onmouseout", "this.style.backgroundColor=d;this.style.color=c");
               
    透明色:
     this.Button1.BackColor = System.Drawing.Color.Transparent;
                this.Button1.BorderStyle = BorderStyle.None;
      

  2.   


    可以用CSS来控制,统一/简便
      

  3.   

    对了,忘记告诉大家了,我的button控件放在DataList中的.不是单独的放到网页上的.应该怎么实现,谢谢大家了!
      

  4.   

    button控件放到哪里都是一样的
      

  5.   

    CSS最好,然后用JS代码,这个没必要用服务器端来处理,效率呀!~