可以呀,可以设置 document.selection.createRange()
设置 moveStart moveEnd 再将之 select()

解决方案 »

  1.   

    刚才根据大侠的代码提示搜索到下面这段程序,已搞定谢谢<HTML>
    <HEAD> 
    <SCRIPT> 
    function insertAtCaret (textEl, text) {
    textEl.focus();
    document.selection.createRange().text += text
    textEl.blur();

    function deleteAtCaret (textEl) {
    textEl.focus();
    document.selection.createRange().moveEnd("character",1)
    document.selection.clear();
    textEl.blur();

    </SCRIPT> 
    </HEAD> 
    <BODY> 
    <FORM NAME="aForm">
    <TEXTAREA NAME="aTextArea" ROWS="5" COLS="80" WRAP="soft"> 这是例子,你可以在这里添加文字、插入文字。 </TEXTAREA> 
    <BR> 
    <INPUT TYPE="text" NAME="aText" SIZE="80" VALUE="我要在光标处插入这些文字"><BR>
    <INPUT TYPE="button" VALUE="我要在光标处插入上面文本框里输入的文字!" ONCLICK="insertAtCaret(this.form.aTextArea, this.form.aText.value);">
    <INPUT TYPE="button" VALUE="我要删除光标后面的一个文字!" ONCLICK="deleteAtCaret(this.form.aTextArea);">
    </FORM>
    </BODY>
    </HTML>
      

  2.   

    http://community.csdn.net/Expert/TopicView.asp?id=4290025