设置光标位置不行吧
<textarea id="TxtID" rows=5 cols="80%"></textarea><br>
<input type=text id="ReplaceID"><br>
<input type=button value="获取选择文本" onclick="window.confirm(document.selection.createRange().duplicate().text);">
<input type=button value="更改选择文本" onclick="document.selection.createRange().duplicate().text=ReplaceID.value;">
<textarea id="TxtID" rows=5 cols="80%"></textarea><br>
<input type=text id="ReplaceID"><br>
<input type=button value="获取选择文本" onclick="window.confirm(document.selection.createRange().duplicate().text);">
<input type=button value="更改选择文本" onclick="document.selection.createRange().duplicate().text=ReplaceID.value;">
http://blog.csdn.net/gjd111686/gallery/27646.aspx
参与一下吧
http://community.csdn.net/Expert/topic/3153/3153580.xml?temp=2.839297E-02
function moveAtCaret(obj,n)
{
//将obj中光标向dirc方向移动n个字符
obj.focus();
var rng=document.selection.createRange();
rng.moveStart("character", n);
rng.select();
}
</SCRIPT>
<body onload="moveAtCaret(show,5)">
<input id="show" value="1234567890">