SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    assigning DHTML events in javascript...

    i am good with javascript but this is pi$$ing me off...

    i am trying to set an onmousemove event to an element, but i need it to pass it like this:

    <div id="someid" onmousemove="move(this)"></div>

    and i want to assign it so it passes the element itself with it... but i cant get that to work with any of these codes...

    document.getElementById('someid').onmousemove="move(this)"; <-- that doesnt work
    document.getElementById('someid').onmousemove=move(this); //<-- that calls the event on the spot
    document.getElementById('someid').onmousemove=move; //<-- that works but wont pass any arguments

    am i missing something or is it like impossable to pass the element with the function?

    Thanks,
    -ALL
    Last edited by ALL; Aug 29, 2006 at 13:33.

  2. #2
    SitePoint Addict ALL's Avatar
    Join Date
    Oct 2005
    Location
    South Dakota
    Posts
    215
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    never mind i figured it out...

    document.getElementById('someid').onmousemove=new Function("move(this)");

    that is what i needed.


Bookmarks

Posting Permissions

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