I don't think there's either an easy or reliable way, but if you want hard and unreliable, you can keep track of the value in the text box by checking it after each
onkeyup event. Compare the current value to the last value and assume the cursor is after the added letter (or in place of the deleted letter).
If the value is the same from one instance to the next, then the user may have hit HOME, END, ->, <-, the up or down arrows, the tab key, a function button, ... You can test for these but it starts to get really complicated.
A perfectly accurate but unfriendly method is to:
document.forms['myForm'].elements['myText'].value = "";
Now you know where the cursor is! It's at 0!
Maybe somebody's gone to all the trouble to write something along the lines of my first idea. Have you Googled this topic?
Dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! ![[infinity] [infinity] [infinity]](/data/assets/smilies/infinity.gif)