This is a working example of a cross-browser implementation of onmouseenter and onmouseleave. (2007-05-13 by Ken Snyder)

If you move your cursor around the screen and cross the purple box (#observation), you will see various mouseover and mouseout events fire. All these events are attached to #observation, but you will notice that onmouseout events are fired when moving into a child element and onmouseover events are fired when moving from a child element. This behavior is arguably counter intuitive. Emulating the functionality of onmouseenter and onmouseleave requires one of a few approaches. Here, we use an event property called relatedTarget (or fromElement/toElement in IE). Another approach is to create an object that fires the event based on the event bubbling.

This example is inspired by Peter-Paul Koch's example outlined on quirksmode.org