ASP.NET怎么在TEXTBOX光标定位处插入字符?谁做过?
我想用个按钮比如它是“+” 如果光标定位在TEXBOX里的字符串的中间位置就插入
[解决办法]
mark
[解决办法]
<script language="javascript">function addString(str){ obj=document.getElementById("txt"); obj.focus(); if(document.selection==null) { var iStart = obj.selectionStart; var iEnd = obj.selectionEnd; obj.value = obj.value.substring(0,iEnd) + str + obj.value.substring(iEnd, obj.value.length); } else { var range = document.selection.createRange(); range.text += str; } }</script><asp:TextBox ID="txt" runat="server" Text="oooooo"></asp:TextBox><input type="button" value="+" onClick="addString('k')">