function AddText(NewCode) {
document.form1.msg_text.focus();
document.selection.createRange().text = NewCode;
}

解决方案 »

  1.   

    <script>
    function insertStr(str)
    {
        //参数:要插入的字符
        txt.focus();
        document.execCommand("Paste",true,str)
    }
    </script>
    <input type=text value="0123456789" id="txt">
    <input type=button onclick="insertStr('bao')" value="bao">
    <input type=button onclick="insertStr('wang')" value="wang">
      

  2.   

    谢谢fason(阿信) 问题解决了。给分
     wanghr100(灰豆宝宝.net)你的我没有试,不过还是谢谢你们这些热心人。
    都有分。^_^