Antônio Gomes wrote:
I'd like to make some manual changes at the cursor/prompt position
inside a html form (specifically on /nsIDOMHTMLTextAreaElement/ and
/nsIDOMHTMLInputElement/ objects.
ps: by cursor (or prompt) I meant the "thing" blinking when I input
object has the focus :)
It is called the caret usually, with Mozilla for text input and textarea
controls there is a method
setSelectionRange(selectionStart, selectionEnd)
exposed to set the text selection and the caret. If you simply want to
set the caret you would do e.g. (JavaScript syntax)
textareaElement.setSelectionRange(5, 5)
If you want to read out the current text selection and/or caret position
you can read out properties
selectionStart
selectionEnd
See
<http://xulplanet.com/references/objref/HTMLTextAreaElement.html#method_setSelectionRange>
Interface is here:
<http://www.xulplanet.com/references/xpcomref/ifaces/nsIDOMNSHTMLTextAreaElement.html>
--
Martin Honnen
http://JavaScript.FAQTs.com/
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout