onmoueover和onmouseout [英] onmoueover and onmouseout

查看:86
本文介绍了onmoueover和onmouseout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i在鼠标悬停事件中添加了一个图像使用



onmouseover = this .style.backgroundImage =''url(/image/1.png)''



然后如何在onmouseout上删除此图片?



谢谢

Hi,

i added a image to a link in mouseover event using

onmouseover=this.style.backgroundImage=''url(/image/1.png)''

then how to remove this image on onmouseout?

Thanks

推荐答案

.buttonCss
{
    background: #dfeffc ;
    width:auto;
    height:auto;
    /*Add More Style As You Need*/
}
.buttonCss:hover
{
    background: #dfeffc url('YourImageUrl');
    width:auto;
    height:auto;
    /*Add More Style As You Need*/
}



使用如下


Use this as follows

<a href="YourLinkHere" class="buttonCss"></a>





试试这会将背景颜色改为Image。



try this it will change background color to Image.


使用CSS规则来设置HTML标签的样式。添加一个规则,当类backimage存在时,它将相应地设置标记的样式。

然后,您只需要添加该类来显示图像并删除该类以将其再次删除。



问候,

- Manfred
Use CSS rules to style your HTML tags. Add a rule that will style your tag accordingly when the class "backimage" is present.
Then all you have to do is add that class to show the image and remove the class to take it away again.

Regards,
— Manfred


这篇关于onmoueover和onmouseout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆