Events problems

Discussion in 'Javascript' started by Niko, Oct 23, 2008.

  1. Niko

    Niko Guest

    Hello,

    Context :

    Dom Structure

    DIV
    |->TABLE
    |->TR
    |->TD
    | |->textNode
    |
    |->TD
    | |->IMG
    |
    |->TD
    |->textNode

    I have added mouseover and mouseout events on the DIV element.

    I need thoses events only triggered when the mouse goes in and out of
    the div but actually (with IE7) they are triggered if the mouse going
    out of a Table cell to go in the adjacent cell.

    I suppose a propagation pb but I don't know how to limit the event
    attachement to the div only without any propagation to enbedded objects.

    Thanks

    Best regards

    Niko
     
    Niko, Oct 23, 2008
    #1
    1. Advertising

  2. Niko

    Rik Wasmus Guest

    On Thu, 23 Oct 2008 14:50:20 +0200, Niko <>
    wrote:

    > Hello,
    >
    > Context :
    >
    > Dom Structure
    >
    > DIV
    > |->TABLE
    > |->TR
    > |->TD
    > | |->textNode
    > |
    > |->TD
    > | |->IMG
    > |
    > |->TD
    > |->textNode
    >
    > I have added mouseover and mouseout events on the DIV element.
    >
    > I need thoses events only triggered when the mouse goes in and out of
    > the div but actually (with IE7) they are triggered if the mouse going
    > out of a Table cell to go in the adjacent cell.
    >
    > I suppose a propagation pb but I don't know how to limit the event
    > attachement to the div only without any propagation to enbedded objects.


    Pretty well explained:
    http://www.quirksmode.org/js/events_mouse.html
    --
    Rik
     
    Rik Wasmus, Oct 23, 2008
    #2
    1. Advertising

  3. Niko

    Jorge Guest

    On Oct 23, 2:50 pm, Niko <> wrote:
    > Hello,
    >
    > Context :
    >
    > Dom Structure
    >
    > DIV
    >   |->TABLE
    >        |->TR
    >            |->TD
    >           |   |->textNode    
    >            |
    >            |->TD
    >           |   |->IMG
    >            |
    >            |->TD
    >               |->textNode
    >
    > I have added mouseover and mouseout events on the DIV element.
    >
    > I need thoses events only triggered when the mouse goes in and out of
    > the div but actually (with IE7) they are triggered if the mouse going
    > out of a Table cell to go in the adjacent cell.
    >
    > I suppose a propagation pb but I don't know how to limit the event
    > attachement to the div only without any propagation to enbedded objects.
    >
    > Thanks
    >
    > Best regards
    >
    > Niko


    div.onmouseover= function (event) {
    var event= event || window.event;
    if (event.target !== this) { return; }
    //DoYourThingsHere
    }

    But, ISTM that IE's 'event' object lacks a 'target' property (?) so...
    somebody else may want help you better than I.

    --
    Jorge.
     
    Jorge, Oct 23, 2008
    #3
  4. On Oct 23, 7:52 am, Jorge <> wrote:
    > On Oct 23, 2:50 pm, Niko <> wrote:
    >
    >
    >
    > > Hello,

    >
    > > Context :

    >
    > > Dom Structure

    >
    > > DIV
    > >   |->TABLE
    > >        |->TR
    > >            |->TD
    > >           |   |->textNode    
    > >            |
    > >            |->TD
    > >           |   |->IMG
    > >            |
    > >            |->TD
    > >               |->textNode

    >
    > > I have added mouseover and mouseout events on the DIV element.

    >
    > > I need thoses events only triggered when the mouse goes in and out of
    > > the div but actually (with IE7) they are triggered if the mouse going
    > > out of a Table cell to go in the adjacent cell.

    >
    > > I suppose a propagation pb but I don't know how to limit the event
    > > attachement to the div only without any propagation to enbedded objects..

    >
    > > Thanks

    >
    > > Best regards

    >
    > > Niko

    >
    > div.onmouseover= function (event) {
    >   var event= event || window.event;
    >   if (event.target !== this) { return; }
    >   //DoYourThingsHere
    >
    > }
    >
    > But, ISTM that IE's 'event' object lacks a 'target' property (?) so...
    > somebody else may want help you better than I.


    IE sets the srcElement property.

    div.onmouseover= function (event) {
    var event = event || window.event;
    var targ = event.target || event.srcElement;
    if (targ !== this) { return; }
    //DoYourThingsHere
    }
     
    Justin McConnell, Oct 23, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shiv
    Replies:
    0
    Views:
    478
  2. Alvin Bruney
    Replies:
    1
    Views:
    726
  3. =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=

    order of events - dynamic checkbox events

    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=, Aug 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    566
    =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?=
    Aug 17, 2005
  4. newbye
    Replies:
    0
    Views:
    582
    newbye
    Jul 6, 2006
  5. Chris

    Events Events Events Please Help

    Chris, Aug 30, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    371
    Chris
    Aug 30, 2005
Loading...

Share This Page