SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
Thread: Cursor Position
-
Apr 25, 2007, 05:25 #1
- 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
-
Apr 25, 2007, 05:39 #2
- 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.
-
Apr 25, 2007, 07:14 #3
- 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.
-
Apr 25, 2007, 07:51 #4
- 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
-
Apr 25, 2007, 08:27 #5
- 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
-
Apr 25, 2007, 08:54 #6
- 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); }
Cross-Browser.com, Home of the X Library
-
Apr 26, 2007, 00:59 #7
- 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 06:45.
Bookmarks