问题描述
我试图建立一个简单的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的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!