CSSのonmouseoverとonmouseoutイベント

1907 ワード

td {
 text-align: center;
 line-height: 30px;
 cursor: hand;
 color:#027CD1;
 /*  onmouseover  */
 onmouseover: expression(οnmοuseοver=function (){
 this.style.borderColor='';
 this.style.backgroundColor='#E5EFF9';
 this.style.color='#000';
 });

 /*  onmouseout  */
 onmouseout: expression(οnmοuseοut=function (){
 this.style.borderColor='';
 this.style.color='';
 this.style.backgroundColor=''});
}

ここでもthisと呼ぶことができます.style.backgroundImage='',
 
$("input[class='buttoncss']").each(function(){
        $(this).mouseover(function(){
            $(this).css("backgroundImage","url(=path%>/image/buttonBG/btnBG.png)");
        });
        $(this).mouseout(function(){
            $(this).css("backgroundImage","url(=path%>/image/buttonBG/btnBG2.png)");
        });
    });

.buttoncss {
 font-family: "tahoma", "  ";
 font-size:9pt; color: #444444;
 cursor:pointer;
 background-image:url(=path%>/image/buttonBG/btnBG2.png);
 font-style: normal ;
 height:25px;
 margin-bottom:4px;
 width:85px;
 border:0px;
}

 
 
 
 
転載先:https://www.cnblogs.com/iteakey/archive/2013/04/26/3044725.html