xxxButtonID.Attributes.Add("style","background-color:red")

解决方案 »

  1.   

    orxxxButtonID.Attributes.Add("class","className"),保证css路径没有错误
      

  2.   

    请问楼下的,这句话是javascript的还是服务器端的?我要客户端的
      

  3.   

    还有,我发现原来.net生成的客户端按钮里面是有style的,而如果把这些style去掉就能实现所要的效果。也就是说,因为按钮已经有style了,所以再更改className就不起作用了。现在问题是,这种情况下,我该用什么变通方式来实现按钮颜色的改变啊
      

  4.   

    document.all.Button1.className ="btncolor"; 
    .btncolor
    {
    background :red;

    }
      

  5.   

    答案已有:button1.style.backgroundColor = "yellow";