Martin Honnen wrote:
cc wrote:
In some browsers you can do that, see
<http://www.faqts.com/knowledge_base/view.phtml/aid/13562/fid/130>
but how can get caret position?
For Mozilla you can read out
textControl.selectionStart
textControl.selectionEnd
as number offsets, if both are the same then you have the caret position
as a number. If they are not the same I am not sure what you would
regard as the caret position, probably selectionStart.
In some apps that's true (e.g. Consider Excel where you can select
(possibly non contiguous) ranges and then cycle through the cells of
this range with the tab key), but near as I can tell, the notion of caret
position (also in Word or OE) is either not well defined here (ie has no
meaning when characters are selected) or means the entire selected area.
In particular, note that the caret does not blink when you have characters
selected. Also, if you have characters selected and use the right arrow
key, the currently selected range will "collapse" and you will wind up
to the right of that formerly selected range. Similarly, pressing the
left arrow key will collapse the range and put the caret to the left (at
least in IE 6, FF 1.0.1+). I haven't been able to think up any experiment
(eg. cut, paste, etc.) which would reveal a differentiation between a left
or right internal caret position.
My testing has been minimal though, and I am happy to be corrected on this point.
Csaba Gabor from Vienna