iframe 在 ff 浏览器的显示问题

ymf1223 2007-12-27 02:16:57
问题是这样,网页有个弹出窗口,通过iframe显示一些信息,在ie里能正常显示,在ff里,内容就不见了。不知道该怎么处理

代码是这样:
<script>
document.write ('<iframe id="HtmlEditor" MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1></iframe>')
frames.HtmlEditor.document.write ('<%="<font color=blue>"&rs("time")&"</font><br>"&rs("content")%>');
frames.HtmlEditor.document.write ('<input name="cc" type="hidden" value="<%="<font color=blue>"&rs("time")&"</font><br>"&rs("content")%>" size="8">');
frames.HtmlEditor.document.body.style.fontSize="10pt";
frames.HtmlEditor.document.close();
</script>


<script>
parent.log.innerHTML='<iframe id="HtmlEditor" MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1></iframe>'
parent.frames.HtmlEditor.document.write ('<%="<font color=blue>"&rs("time")&"</font><br>"&content%>');
parent.frames.HtmlEditor.document.body.style.fontSize="10pt";
parent.frames.HtmlEditor.document.close();
</script>
...全文
329 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
xdspower 2008-01-07
  • 打赏
  • 举报
回复
你在firefox下安装一个firebug的调试扩展工具来调试吧,很好用的,可以设置断点什么的,还可以看到dom的具体情况。
nicholsky 2008-01-07
  • 打赏
  • 举报
回复
frames取的是name,DOM取的是ID。
llddy 2008-01-07
  • 打赏
  • 举报
回复
路过
ymf1223 2008-01-02
  • 打赏
  • 举报
回复
恳请哪位高手帮忙解决一下啊
ymf1223 2008-01-01
  • 打赏
  • 举报
回复
问题自己还是没能解决
ymf1223 2007-12-31
  • 打赏
  • 举报
回复
有哪位高手指教一下啊
ymf1223 2007-12-30
  • 打赏
  • 举报
回复
我尝试了这个,同样在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>
ymf1223 2007-12-29
  • 打赏
  • 举报
回复
请楼上赐教
xdspower 2007-12-29
  • 打赏
  • 举报
回复
你改的不对啊,比较我改的和你原有的异同,其实很容易找到什么是关键的
ymf1223 2007-12-29
  • 打赏
  • 举报
回复
请问哪位有更好的方法吗?
路人乙e 2007-12-28
  • 打赏
  • 举报
回复
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();
ymf1223 2007-12-28
  • 打赏
  • 举报
回复
还不是很明白
路人乙e 2007-12-28
  • 打赏
  • 举报
回复
标准访问子窗体document代码:
document.getElementById("dataLoader").contentWindow.document;
window.frames["frameName"].document
ymf1223 2007-12-28
  • 打赏
  • 举报
回复
我把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里也还是不行
ymf1223 2007-12-28
  • 打赏
  • 举报
回复
我在网上搜过一些,可是在ff里仍然实现不了

象这个又不知道怎么用:
Mozilla支持通过IFrameElmRef.contentDocument访问iframe的document对象的W3C标准;而IE要求用户通过document.frames[ "IframeName "]获取它,再访问结果中的document。
ymf1223 2007-12-28
  • 打赏
  • 举报
回复
我这样改了还是不对:
<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里没显示内容
jnkc369 2007-12-28
  • 打赏
  • 举报
回复
有iframe時會在IE中出現異常
ymf1223 2007-12-28
  • 打赏
  • 举报
回复
非常感谢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>
ymf1223 2007-12-28
  • 打赏
  • 举报
回复
多谢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>

xdspower 2007-12-28
  • 打赏
  • 举报
回复
上面发错,下面可能能用在FF上,不过你还要写出兼容的才行。
document.write(' <iframe id="HtmlEditor" MARGINHEIGHT=1 MARGINWIDTH=1 height="100" width=100% frameborder=1> </iframe> ');
var myIfram=document.getElementById("HtmlEditor").contentWindow.document

myIfram.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();
加载更多回复(5)

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧