只能用innerHTML来输出.
或者用focus后Copy和Parse来替换.

解决方案 »

  1.   

    1.demo.htm<iframe src="in.htm" name="in"></iframe>
    <input type="text" name="otext">in.htm<input type="button" id="btn" value="Button">
    <input type="text" id="txt" value="Text">
    <script>
    document.onclick=function()
    {
     top.document.all.otext.value=event.srcElement.id
    }
    </script>
    2.方法一:<script>
    function insertStr(str) {
        txt.focus();
    document.selection.createRange().text = 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">方法二:<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.   

    谢谢楼上的回复,第一个问题在我没有说清楚,是在设计编辑模式。designMode='on'.请再帮助。