Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Get Caret Position (FireFox)

Reply
Thread Tools

Get Caret Position (FireFox)

 
 
ryanmhuc@yahoo.com
Guest
Posts: n/a
 
      11-03-2005
Is there a way to get the caret position of a text input using FireFox.
I am aware of ways to such with IE but have been unable to accomplish
in FireFox and have not found a solution in the groups or web. Anyone?
Thanks

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      11-03-2005


wrote:

> Is there a way to get the caret position of a text input using FireFox.


For textControls in Firefox/Mozilla you can read out
textControl.selectionStart
textControl.selectionEnd
selectionEnd should be the caret position.
To change the selection you can use
textControl.setSelectionRange(newSelectionStart, newSelectionEnd)

Opera 8 also supports those properties/methods on text controls.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Get the screen position for the caret in JEditorPane Stefan Istrate Java 0 04-16-2009 11:31 AM
Get the screen position for the caret in JEditorPane Stefan Istrate Java 1 04-16-2009 10:08 AM
advanced q?: mouseup position to caret position? brendan Javascript 0 08-29-2006 10:48 AM
How to get cursor insertion point (caret position) from text box DaveR ASP .Net 2 11-17-2004 09:39 AM
How do I get the caret position in a textarea? torch Javascript 3 06-20-2004 12:13 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57