I have been searching for this for some time, but haven't got any explanation.
For "onclick" and other events in javascript, the event handler returning false means "prevent default action". However, there is one exception for "onmouseover". For "onmouseover", returning true means "prevent default action".
Why is there such a weird exceptional case for "onmouseover"?
Instead of using return false / true to prevent default event behaviour, use the default method / attribute on the event object:
elem.onmouseover = function(e) {
if (!e) var e = window.event; // IE
if(e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false; // IE
}
}
As far as I know, returning true
to prevent the url of a link to show up in the status bar is an IE-specific (mis-)feature. And trying to understand why IE does things the way it does is often a lost cause - just live with it...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With