This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Cursor position Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Cursor position " Watch "Cursor position " New topic

Cursor position

zheng yu

Joined: Apr 25, 2001
Posts: 28
how to know cursor position when user click the text field.
In my situation , there has no keyboard . Input device is touch panel & mouse . i created some buttons like DEL , BS , etc .user can use mouse to position , use these buttons to edit .
Ca this be done by using javascript ?
Thanx in advance
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
It depends on the browser. I'm not sure about Netscape, but in IE there is an event object passed to your event handler by default. Inside of your event that handles the button click you can simply inspect the event.x and event.y properties to get the coordinates of the click.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Cursor position
Similar Threads
Image in place of buttons
problem with internalframe glassPane
DHTML and Javascript
Placing Cursor at End of Text