arguments for onmouseover

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wim Roffal

    arguments for onmouseover

    I want to set an onmousover function with arguments:

    <a id="test" href="test.htm" >testje</a>

    anchor = document.getEle mentById("test" );
    anchor.onmouseo ver = function(){ anchorMouseover (this,event) };

    function anchorMouseover (anchor,event)
    { ...
    }

    In this code "this" will provide the anchor, but I can't find a way to get
    the event. Can anyone give me some suggestions how to do get this?

    Thanks a lot...

    Wim


  • Steve

    #2
    Re: arguments for onmouseover

    Try

    anchor.onmouseo ver = function(event) { anchorMouseover (this,event) };

    Steve

    "Wim Roffal" <wimroffelpleas e@nospamm-planet.nl> wrote in message
    news:cipfak$8rq $1@reader08.wxs .nl...[color=blue]
    >I want to set an onmousover function with arguments:
    >
    > <a id="test" href="test.htm" >testje</a>
    >
    > anchor = document.getEle mentById("test" );
    > anchor.onmouseo ver = function(){ anchorMouseover (this,event) };
    >
    > function anchorMouseover (anchor,event)
    > { ...
    > }
    >
    > In this code "this" will provide the anchor, but I can't find a way to get
    > the event. Can anyone give me some suggestions how to do get this?
    >
    > Thanks a lot...
    >
    > Wim
    >
    >[/color]


    Comment

    • Martin Honnen

      #3
      Re: arguments for onmouseover



      Wim Roffal wrote:
      [color=blue]
      > I want to set an onmousover function with arguments:
      >
      > <a id="test" href="test.htm" >testje</a>
      >
      > anchor = document.getEle mentById("test" );
      > anchor.onmouseo ver = function(){ anchorMouseover (this,event) };[/color]

      anchor.onmouseo ver = function (evt) {
      if (typeof evt == 'undefined') {
      evt = window.event;
      }
      anchorMouseover (this, evt);
      }
      should deal with both Mozilla and DOM browsers passing the event as an
      argument and with IE and compatible using window.event.




      --

      Martin Honnen

      Comment

      • Evertjan.

        #4
        Re: arguments for onmouseover

        Wim Roffal wrote on 21 sep 2004 in comp.lang.javas cript:
        [color=blue]
        > I want to set an onmousover function with arguments:
        >
        > <a id="test" href="test.htm" >testje</a>
        >
        > anchor = document.getEle mentById("test" );
        > anchor.onmouseo ver = function(){ anchorMouseover (this,event) };
        >
        > function anchorMouseover (anchor,event)
        > { ...
        >}
        >
        > In this code "this" will provide the anchor, but I can't find a way to
        > get the event. Can anyone give me some suggestions how to do get this?
        >[/color]

        Why do you want to specify the event?

        You already know [and the code knows] the event is onmouseover.

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress,
        but let us keep the discussions in the newsgroup)

        Comment

        Working...