Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Event question and finding pointer position at event


  • From: sclay at ufl.edu (Steve Clay)
  • Subject: [Javascript] Event question and finding pointer position at event
  • Date: Tue Mar 28 13:54:13 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/