Hello
Is anybody knowing a good way (the most will be by using X library) to find Cursor position ?
Many thanks
Edit/Delete Message
| SitePoint Sponsor |
Hello
Is anybody knowing a good way (the most will be by using X library) to find Cursor position ?
Many thanks
Edit/Delete Message





You can use the mousemove event to find it - it will be at e.clientX, e.ClientY.




You might want to use prototype library, check Event.pointerX and Event.pointerY method.
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
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
If you are using the X Library, then...
Ref: xEventCode:<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); }
Cross-Browser.com, Home of the X Library
it work perfectly!
many thanks for your help and for your great work on X library.
Last edited by gebura; Apr 26, 2007 at 06:45.
Bookmarks