SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: Cursor Position

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cursor Position

    Hello

    Is anybody knowing a good way (the most will be by using X library) to find Cursor position ?

    Many thanks
    Edit/Delete Message

  2. #2
    Caveat surfer Buddy Bradley's Avatar
    Join Date
    May 2003
    Location
    Cambridge, UK
    Posts
    2,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use the mousemove event to find it - it will be at e.clientX, e.ClientY.

  3. #3
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You might want to use prototype library, check Event.pointerX and Event.pointerY method.

  4. #4
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    prototype have problems with json reference implementation,so i chose to not use it.

    i didn't find any good way to get "e" since i am unable to use
    window.onmousemove = afunction and get params

    is there any way to do something like e = new mouseEvent (); ?

    many thanks

  5. #5
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    more explanations may be usefull:

    if have a function name show_infobulle( msg) witch is cast by some onmouseover function like <p onmouseover="show_infobulle('hello')" >

    because i use show_infobulle(msg) i am unable to make something like onmouseover= show_infobulle without loosing 'msg'

    so i don't find any good way to get the mousevent from witch i can get pageX etc...

    please scuse my poor english

  6. #6
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are using the X Library, then...
    Code:
    <p onmouseover="show_infobulle(event, 'hello')">...</p>
    
    function show_infobulle(event, msg)
    {
      var e = new xEvent(event);
      alert(msg + '\n\nx = ' + e.pageX + '\n\ny = ' + e.pageY);
    }
    Ref: xEvent

  7. #7
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it work perfectly!

    many thanks for your help and for your great work on X library.
    Last edited by gebura; Apr 26, 2007 at 05:45.


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
  •