当前位置: 代码迷 >> ASP.NET >> 请教怎么在TextBox设置为MultiLine后,在Textbox文字中插入一段文字
  详细解决方案

请教怎么在TextBox设置为MultiLine后,在Textbox文字中插入一段文字

热度:8362   发布时间:2013-02-26 00:00:00.0
请问如何在TextBox设置为MultiLine后,在Textbox文字中插入一段文字
请问如何在TextBox设置为MultiLine后,在Textbox文字中插入一段文字,可以使用javascript,也可以在后台写,如何作?

------解决方案--------------------------------------------------------
<body> <form id= "form1 " runat= "server "> </form> <textarea id= "txt1 " rows= "20 " style= "width:200px "> 11111111111112222222222222222222 </textarea> <input type= "button " onclick= "javascript:return GoInsert(); " value= "Insert "/> </body> </html> <script> function GoInsert(){ var txt = document.getElementById( "txt1 "); txt.focus(); var range = document.selection.createRange(); range.text += "DDDDDDDD "; //return false;} </script>
  相关解决方案