IFRAME在IE6下的显示问题

xiaolei-happyness 2003-07-14 06:54:10
document.write("<iframe width=750 height=1100 frameborder=0 id=contentframe src='about:<img id=content border=0 width=700 src=\""+doc+ "/$file/"+imgs[0]+"\">'></iframe>");
如上代码,在IE5下面显示正常,IE6下却报错,为什么????
...全文
298 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
希默软件 2003-07-15
  • 打赏
  • 举报
回复
换个方式

<script>
document.write("<iframe width=750 height=1100 frameborder=0 id=contentframe src='about:'></iframe>");
contentframe.document.write("<img id=content border=0 width=700 src=123.jpg>");
</script>
fason 2003-07-15
  • 打赏
  • 举报
回复
window.frames['iframeName'].document.getElementById('imgID').src='1.jpg'

name和id是不同的
b3b4s3d4 2003-07-15
  • 打赏
  • 举报
回复
<script>
document.write("<iframe width=750 height=1100 frameborder=0 id=contentframe src='about:blank'></iframe>");
contentframe.document.write("<img id=content border=0 width=700 src=123.jpg>");
</script>
src='about:'不会认为是一个空页面,IE会试图去NET上寻找该页面.结果当然是找不到.
尽量不要用document.write.
试用下面的方法:
<script>
oFrame=document.createElement("iframe width=750 height=1100 frameborder=0 id=contentframe")
document.body.appendChild(oFrame)
contentframe.document.loacation="about:blank"
oImg=contentframe.document.createElement("img id=content border=0 width=700 src=123.jpg")
contentframe.document.body.appendChild(oImg)
</script>
document.write其实只负责在当前语句位置写文本代码,容易页面代码不符合规范:如:
<body>
<table>
<script>
document.wirte("<img src='123.gif'>")
</script>
<tr>
<td>
</td>
</tr>
<table>
</body>
紫郢剑侠 2003-07-15
  • 打赏
  • 举报
回复
关注!
xiaolei-happyness 2003-07-15
  • 打赏
  • 举报
回复
请问如果在IFRAME的SRC中指定一个1.html,1.html中有个IMG对象,请问如何在IFRAME中指定IMG对象的SRC呢,谢谢先!!
xiaolei-happyness 2003-07-15
  • 打赏
  • 举报
回复
好象是不行啊,报错说是拒绝访问啊!
possible_Y 2003-07-14
  • 打赏
  • 举报
回复
ie6不支持about:html代码的方式

87,987

社区成员

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

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