onMouseOver和onMouseEnter的区别 [英] Difference between onMouseOver and onMouseEnter

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

问题描述

我试图建立一个简单的html表格,当用户将鼠标移到该表格上时,该表格会突出显示一行。不幸的是,CSS悬停项目不适用于IE。这让我在javascript中模拟它。我可以使用 onmouseenter onmouseover



是它们之间的区别,我应该使用哪一个?

首先, onmouseenter 是特定于IE的。在其他浏览器中不起作用,除非您使用可以模拟此事件的jQuery。



其次,当鼠标进入边界时, onmouseenter onmouseover 的元素。但是,如果鼠标在第一个元素内输入子元素, onmouseenter 不会再次触发(不会冒泡)。


I'm trying to have a simple html table, that highlights a row as a user mouses over it. Unfortunately the css hover item doesn't work for IE. That leaves me to simulate it in javascript. I can use either onmouseenter or onmouseover.

What is the difference between them, and which one should I use?

解决方案

First of all, onmouseenter is IE-specific. Doesn't work in other browsers unless you use jQuery which can simulate this event.

Secondly, both onmouseenter and onmouseover fire when the mouse enters the boundary of an element. However, onmouseenter doesn't fire again (does not bubble) if the mouse enters a child element within this first element.

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

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