呵呵,来这里拿分。
idContent.document.write(document.form1.content.value)

解决方案 »

  1.   

    哈哈,是<html>(包含<html>)...<body>(不包含)和</html>
      

  2.   

    写进去是innerText,读出来当然也是innerText 啦,干嘛去找outerHTML?document.form1.content.value = idContent.document.body.innerText
      

  3.   

    chenzengxi(懒猫) :我的意思是:将刚才用document.write写入的html代码
    提取出来,我是用
    document.form1.content.value = idContent.document.body.outerHTML;
    但是丢掉了<html>(包含<html>)...<body>(不包含)和</html>
      

  4.   

    emu(ston):innerText是去除html标志之后剩余的东西
      

  5.   

    <html>
    <body><iframe id=test>
    </iframe>
    <BR>
    <button onclick="testIframe()">test</button>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function testIframe()
    {
    test.document.body.innerText = "<html>asdfsdf</html>"
    alert(test.document.body.innerText)
    alert(test.document.body.outerHTML)
    }
    //-->
    </SCRIPT></body>
    </html>
      

  6.   

    但是我的iframe的状态现在为designidContent.document.designMode = "On";
      

  7.   

    天,你到底在干什么啊?
    你是要描述当前iframe的完整的HTML代码?
    <html>
    <body><iframe id=test>
    </iframe>
    <BR>
    <button onclick="testIframe()">test</button>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function testIframe()
    {
    test.document.write("asdfsdfsfgsdf");
    html = "<html>"+test.document.body.outerHTML+"</html>"
    alert(html)
    }
    //-->
    </SCRIPT></body>
    </html>
      

  8.   

    chenzengxi(懒猫):不一样,刚才是朝iframe中写入内容,现在是从iframe中提取内容
      

  9.   

    好像没什么好办法了,为什么一定要<html></html>那??
    document.form1.content.value = "<HTML>" +idContent.document.body.outerHTML+"</HTML>";
    希望没人骂我,这样也算???呵呵....
      

  10.   

    不过,iframe只能编辑body里的内容,这样做也不会有大问题,不过你的需求也太离谱了,呵呵.
      

  11.   

    不仅仅是html啊,我的<title></title>都丢失了
      

  12.   

    那样的话你不如,在你的编辑器功能栏上,再写几个input,分别是title,head...,然后把它们拚起来。
      

  13.   

    多谢二位,我自己解决了这个问题
    document.form1.content.value = document.documentElement.outerHTML;
      

  14.   

    documentElement PropertyRetrieves a reference to the root node of the document.