...

View Full Version : Problem with "onmouseout" and Netscape 6.x



SIGINT
08-24-2002, 12:13 PM
Hi there,
I do have an problem with Netscape and "onmouseout" event:
I want to hide a DIV when i leave it,but it gets hidden,when i move the cursor from the text (in the div) to a free area inside the div... IE is working fine..



<div id="menu" style="position:absolute;height:200;width:100"
onmouseout="document.getElementById('menu').style.visibility='hidden'">
text
text
text
</div>


Does anyone know howto solve this prob??

THX SIGINT

P.S.: It's the same with IE and Links :(

scroots
08-24-2002, 12:51 PM
change onmouseout
to:
onMouseout

scroots

SIGINT
08-24-2002, 01:33 PM
?!?!? Events aren`t case-sensitive...

The problem is,that "onmouseout" is raised when i leave a link that`s in the DIV,but i want it to raise only,when i leave the DIV itself...

jkd
08-24-2002, 04:00 PM
The onmouseout event bubbles, which means if onmouseout is fired in a childNode, it will eventually bubble up to the <div>.

HTMLElement.prototype.contains = function(node) {
var range = this.ownerDocument.createRange();
range.selectNode(this);
return range.intersectsNode(node);
}

This emulates the contains() function in Moz, from which you'll go like:

onmouseout="if (!this.contains(event.relatedElement || event.toElement)) { doNormalStuff() }"

Or something like that. :)

SIGINT
08-25-2002, 08:50 AM
Hi jkd,
thanks for the answer, but i'm new to JavaScript and don't understand this code:
I thought prototype is only supportet by Array-Objects,what does HTMLelement mean (i've tried DIV.prototype.contains=...)

funtion(node)?!?!? <- is this some type of anonymous function?


Thx SIGINT

jkd
08-25-2002, 02:21 PM
Originally posted by SIGINT
Hi jkd,
thanks for the answer, but i'm new to JavaScript and don't understand this code:
I thought prototype is only supportet by Array-Objects,what does HTMLelement mean (i've tried DIV.prototype.contains=...)

funtion(node)?!?!? <- is this some type of anonymous function?


Thx SIGINT

HTMLElement is an object class that Gecko browsers expose. The DOM1 HTML specs call for such interfaces, but only Mozilla/NS6 allows you to prototype them.

To prototype div's it would be HTMLDivElement.prototype

And yes, function(node) is an anonymous function. :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum