Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    @Duesseldorf
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Netscape Problem with "onmouseout" and Netscape 6.x

    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..

    Code:
    <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
    Last edited by SIGINT; 08-24-2002 at 01:25 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    change onmouseout
    to:
    onMouseout

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #3
    New Coder
    Join Date
    Aug 2002
    Location
    @Duesseldorf
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ?!?!? 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...

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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.

  • #5
    New Coder
    Join Date
    Aug 2002
    Location
    @Duesseldorf
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •