DOM对象引用格式不对
parent.frames.HtmlEditor
不一定能够活动正确的对象引用,你在网上找兼容的方法吧。

解决方案 »

  1.   

    我在网上搜过一些,可是在ff里仍然实现不了象这个又不知道怎么用:
    Mozilla支持通过IFrameElmRef.contentDocument访问iframe的document对象的W3C标准;而IE要求用户通过document.frames[ "IframeName "]获取它,再访问结果中的document。 
      

  2.   

    我把frames.HtmlEditor.document.write ('<font color=blue>aaa</font><br>bbb');
    改成这样:window.frames["HtmlEditor"].document.write ('<font color=blue>aaa</font><br>bbb');   
    在ie里行,在ff里也还是不行
      

  3.   

    标准访问子窗体document代码:
    document.getElementById("dataLoader").contentWindow.document;
    window.frames["frameName"].document
      

  4.   

    window.frames["HtmlEditor"].document.write ('<%="<font color=blue>"&rs("time")&"</font><br>"&rs("content")%>');
    window.frames["HtmlEditor"].document.write ('<input name="cc" type="hidden" value="<%="<font color=blue>"&rs("time")&"</font><br>"&rs("content")%>" size="8">');
    window.frames["HtmlEditor"].document.body.style.fontSize="10pt";
    window.frames["HtmlEditor"].document.close();
      

  5.   

    楼上的方法我用过,在ie  里可以实现,在 ff 里就失效了
      

  6.   

    HtmlEditor is the iframe's name, not id
    //window.frames["frame_name"]
      

  7.   

    你试一试下面的办法:
       document.write ('<iframe id="HtmlEditor"  MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1></iframe>');   document.getElementById("dataLoader").contentWindow.document
      

  8.   

    上面发错,下面可能能用在FF上,不过你还要写出兼容的才行。
    document.write(' <iframe   id="HtmlEditor"     MARGINHEIGHT=1   MARGINWIDTH=1   height="100"   width=100%   frameborder=1> </iframe> ');
    var myIfram=document.getElementById("HtmlEditor").contentWindow.documentmyIfram.write ('<%="<font color=blue>"&rs("time")&"</font><br>"&rs("content")%>');
    myIfram.write ('<input name="cc" type="hidden" value="<%="<font color=blue>"&rs("time")&"</font><br>"&rs("content")%>" size="8">');
    myIfram.body.style.fontSize="10pt";
    myIfram.close();
      

  9.   

    多谢sq_zhuyi 。 原来把id换成name 就行了请问这一段该怎么修改?
    <script>
    parent.log.innerHTML='<iframe id="HtmlEditor"  MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1></iframe>'
    parent.frames.HtmlEditor.document.write ('<%=content%>');
    parent.frames.HtmlEditor.document.body.style.fontSize="10pt";
    parent.frames.HtmlEditor.document.close();
    </script>
    <span id=log></span>
      

  10.   

    非常感谢xdspower 的帮助,用你的方法也可以实现兼容ff了
    请帮我再看看这段还需怎样修改:
    <script>
    parent.log.innerHTML='<iframe id="HtmlEditor"  MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1></iframe>'
    parent.frames.HtmlEditor.document.write ('<%=content%>');
    parent.frames.HtmlEditor.document.body.style.fontSize="10pt";
    parent.frames.HtmlEditor.document.close();
    </script>
    <span id=log></span>
      

  11.   

    我这样改了还是不对:
    <script>
    parent.document.getElementById("log").innerHTML='<iframe id="HtmlEditor"  MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1></iframe>'
    window.parent.frames["HtmlEditor"].document.write ('<%=content%>');
    window.parent.frames["HtmlEditor"].document.body.style.fontSize="10pt";
    window.parent.frames["HtmlEditor"].document.close();
    </script>
    <span id=log></span>
    在ie里正常,在ff里没显示内容
      

  12.   

    我尝试了这个,同样在ie里可以正常,在ff里还是没内容<script>
    parent.document.getElementById("log").innerHTML='<iframe id="HtmlEditor2"  MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1></iframe>'
    var   myIfram=parent.document.getElementById("HtmlEditor2").contentWindow.document 
    myIfram.write   ('<%=content%>'); 
    myIfram.body.style.fontSize="10pt"; 
    myIfram.close();
    </script>
    <span id=log></span>
      

  13.   

    你在firefox下安装一个firebug的调试扩展工具来调试吧,很好用的,可以设置断点什么的,还可以看到dom的具体情况。
      

  14.   

    frames取的是name,DOM取的是ID。