也就是我的button鼠标移动的时候改变button样式谢谢

解决方案 »

  1.   

    onmouseover="this.style='你的样式'"
      

  2.   

    添加<link href="css/css.css" type="text/css" rel="Stylesheet" />
    对css的引用
    在css中写上
    .btn1 {
    border-right: #7b9ebd 1px solid; padding-right: 2px; border-top: #7b9ebd 1px solid; padding-left: 2px; font-size: 12px; filter: progid:dximagetransform.microsoft.gradient(gradienttype=0, startcolorstr=#ffffff, endcolorstr=#cecfde); border-left: #7b9ebd 1px solid; cursor: hand; color: black; padding-top: 2px; border-bottom: #7b9ebd 1px solid; width:70;
    }
    .btn2 {
    border-right: #7ebf4f 1px solid; padding-right: 2px; border-top: #7ebf4f 1px solid; padding-left: 2px; font-size: 12px; filter: progid:dximagetransform.microsoft.gradient(gradienttype=0, startcolorstr=#ffffff, endcolorstr=#cae4b6); border-left: #7ebf4f 1px solid; cursor: hand; color: black; padding-top: 2px; border-bottom: #7ebf4f 1px solid; width:70;
    }<input class="btn1" onmouseover="this.className='btn2'" onmouseout="this.className='btn1'" name="submit" type="submit" id="btnSub" value=" 确 定 " runat="server" onserverclick="btnSub_ServerClick" />
      

  3.   

    onmouseover,onmouseout指向不同的css中的项
      

  4.   

    对不起我没有写完整
    我的是
    <asp:Button ID="Button1" runat="server" Text="登录"  class="btn" onmousemove="this.className='btnOver'" onmouseout="this.className='btn'" OnClick="Button1_Click" />
    而我想改成
    <asp:Button ID="Button1" runat="server" Text="登录"  class="btn" OnClick="Button1_Click" />
    而且效果一样
    我就是不想要这样所以才来这里发贴的
      

  5.   

    可以直接写在页面代码中onmouseover="this.bgcolor='#000000'"
    或者用htc,在css中的button的样式中用behavior
    .button
    {
      behavior:url(a.htc);
    }a.htc:
    <PUBLIC:COMPONENT> 
    <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="ChangeColor()" /> <SCRIPT LANGUAGE=\"JScript\"> 
       function ChangeColor() 
       { 
          this.bgcolor = '#000000';
       } 
    </SCRIPT> 
    </PUBLIC:COMPONENT>
      

  6.   

    我上面改的bgcolor,楼主改为改style就ok
      

  7.   

    不行啊:
    1.htm:
    <STYLE>
    .button
    {
      behavior:url(a.htc);
    }
    </STYLE><input type="button" value="ddddd" class="button"/>
    -------
    a.htc:
    <PUBLIC:COMPONENT> 
    <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="ChangeColor()" /> <SCRIPT LANGUAGE=\"JScript\"> 
       function ChangeColor() 
       { 
          this.bgcolor = '#000000';
       } 
    </SCRIPT> </PUBLIC:COMPONENT> 以上代码不行
    我哪里写错了谢谢
      

  8.   

    <SCRIPT LANGUAGE="JScript"> 
       function ChangeColor() 
       { 
           
          this.style.backgroundColor = '#000000';
       } 
    </SCRIPT>
      

  9.   

    还是不行啊:
    我加了alert('')也没有触发
    1.htm:
    <STYLE>
    .button
    {
      behavior:url(a.htc);
    }
    </STYLE><input type="button" value="ddddd" class="button"/>
    -------
    a.htc:
    <PUBLIC:COMPONENT> 
    <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="ChangeColor()" /> <SCRIPT LANGUAGE=\"JScript\"> 
       function ChangeColor() 
       { 
          alert('');
          this.style.backgroundColor = '#000000';
       } 
    </SCRIPT> </PUBLIC:COMPONENT> 以上代码不行
    我哪里写错了谢谢
      

  10.   

    LANGUAGE=\"JScript\"> 
    ===>不要\"language="jscript"
      

  11.   

    谢谢好了
    关于htc的用法
    我下一贴再开谢谢