日期:2014-05-16 浏览次数:20427 次
<a href="javascript:void(0)" onclick="a()">回复他</a> <textarea id="t" cols="100" rows="10">abc</textarea> <script> function a(){ var e=document.getElementById("t"); e.focus(); e.innerText="回复1楼:\r\n"; } </script>
------解决方案--------------------
<a href="javascript:doit('回复1楼');void(0);">回复他</a> <textarea id="ta" rows="10" cols="40">xxx</textarea> <script language="JavaScript"> function doit(s){ var t = document.getElementById("ta"); t.value = s + "\n"; t.focus(); if(document.all) t.createTextRange().collapse(false); else t.selectionStart = t.value.length; } </script>