Mouse Events onmouseout issue event bubbling

Quick JavaScript example to handle the onmouseout event to prevent event bubbling in IE.

if(window.addEventListener)

{

// Mozilla, Netscape, Firefox

object.addEventListener(‘mouseover’,function() {this.className = “objectVisible”;false)

object.addEventListener(‘mouseout’,function() {this.className = “objectNotVisible”;return true;}, false)}

else { // IE

object.onmouseenter = function() {this.className = “objectVisible”;return false;};

object.onmouseleave = function() {this.className = “objectNotVisible”;return false;};

}

This entry was posted in JavaScript, Uncategorized and tagged . Bookmark the permalink.

Comments are closed.