[Javascript] Event question and finding pointer position at event

Steve Clay sclay at ufl.edu
Tue Mar 28 13:55:00 CST 2006


Tuesday, March 28, 2006, 2:42:26 PM, Bill Moseley wrote:
> I always think of bubbling up or capturing, but not bubbling down.

Sorry, poor usage on my part. I was thinking down because child elements
usually display on top of their parents, but events do bubble (as bubbles
do) /up/ the DOM tree.

Here was the page I should have referred to:
http://www.quirksmode.org/js/events_mouse.html#mouseover

In your case you can either worry about stopping propagation on every child
element, or store the state in a property:

myDiv.onmouseover = function() {
  if (this.isAlreadyMousedOver) return false;
  // do stuff here
  this.isAlreadyMousedOver = true;
}
myDiv.onmouseout = function() {
  this.isAlreadyMousedOver = false;
  // do stuff here
}

Steve
-- 
http://mrclay.org/




More information about the Javascript mailing list