昨天,一个朋友给我他的一个作品,说他怎么也没法显示那个iframe里面内容,而他们都单独显示的时候都是非常正确的, 这是一个比较奇怪的现象了.
于是从页面源代码开始一行行的看,那些代码都很正常,iframe也是引用正确
的地址,各项属性也标准,写了最简单直显示文本的让它嵌在框架页,也是没法
显示.. 代码如下所示[大家可以先看看]:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<title>index.jpg</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--Fireworks 8 Dreamweaver 8 target. Created Fri Dec 09 14:52:40 GMT+0800 2005-->
<style type="text/css">
<!--
body,td,th {
font-size: 13px;
color: #CCCCCC;
}
body {
margin-left: 80px;
margin-top: 0px;
background-image: url(images/bj.JPG);
}
-->
</style></head>
<body bgcolor="#ffffff">
<table border="0" cellpadding="0" cellspacing="0" width="800">
<!-- fwtable fwsrc="index.png" fwbase="index.jpg" fwstyle="Dreamweaver" fwdocid = "2121624114" fwnested="0" -->
<tr>
<td><img src="images/spacer.gif" width="235" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="565" height="1" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>
<tr>
<td colspan="2"><img name="index_1" src="images/index_1.jpg" width="800" height="48" border="0" alt=""></td>
<td><img src="images/spacer.gif" width="1" height="48" border="0" alt=""></td>
</tr>
<tr>
<td colspan="2" background="images/index_2.jpg"> </td>
<td><img src="images/spacer.gif" width="1" height="19" border="0" alt=""></td>
</tr>
<tr>
<td background="images/index_3.jpg"> </td>
<td align="center" valign="top" background="images/index_4.jpg"><iframe name="I1" src="y/index.html" marginwidth="1" marginheight="1" border="0" frameborder="0" width="550" height="530">
浏览器不支持嵌入式框架,或被配置为不显示嵌入式框架。</iframe></td>
<td><img src="images/spacer.gif" width="1" height="533" border="0" alt=""></td>
</tr>
</table>
</body>
</html>
看到那个编码是utf-8,应该不会有问题吧,不过改成gb2312,那个简单的
html页面能够在iframe里显示了..告诉朋友说是这个问题后,他说那个需要嵌入的页面还是没法显示,.我试了下,果真还是老样子 ..
这下可有点懵了,于是尝试去掉所有可以去掉的标签,诸如注释,还有html版DTD声明什么的,然后再测试,结果终于可以显示那个页面了..htmlDTD申明每个页面都有可能包含,应该不会出错.而且标准的页面都会有,看样子问题出在那些注释里了.刚开始一直都还不相信.注释在Dreamweaver里是灰色的,而正是这样就容易忽视它了..解决能够显示的问题后,我一直没有放弃检查到底是哪句注释会出错......
这句代码有点意思, <!-- saved from url=(0014)about:internet --> 包含了一个about: 的字样,可能ie对这样的字符段比较敏感,于是中止了iframe的显示,对了.忘了告诉大家,那个没法显示嵌入页面的iframe里是一个blank页面. ie默认空白页的命令是about:blank,...不知这算谁的问题?是ie还是iframe的?.
另附:嵌入页面源代码[是javascript做的水族馆屏保]:
<style type="text/css">
<!--
body {
background-image: url(../images/index_4_1.JPG);
}
-->
</style>
<body topmargin="0" leftmargin="0">
<center>
<div id="FishJar" style="position:relative;width:512px;height:389px;border:2px inset white;background:url(images/sea.jpg) #059;overflow:hidden">
<div id="Loading" style="width:180px;height:385px;text-align:left">
<table width=100% height=80%><tr>
<td><font style="font:normal 12px 宋体;color:#fff;letter-spacing:2px;white-space:nowrap"> 资料载入中,请稍候<span id="LoadingDots">....</span> </font></td>
</tr></table>
</div>
</div>
</center>
</body>
</html>
<script language="javascript">
var FishPath="./" //图片路径 ( 若与网页位置相同请设为 ./ 或空白 )
var FishProp=new Array()
var FishName=new Array()
FishName[0]="images/fish2"
FishName[1]="images/fish1"
FishName[2]="images/fish2"
FishName[3]="images/fish1"
FishName[4]="images/fish3"
FishName[5]="images/fish1"
FishName[6]="images/fish4"
FishName[7]="images/fish2"
FishName[8]="images/fish4"
FishName[9]="images/fish3"
var FishPreload=new Array()
var j=0
for(i=0;i<FishName.length;i++){ //预先载入图片
FishPreload[j]=new Image()
FishPreload[j].src=eval("FishPath+FishName[i]+'_l.gif'")
j++
FishPreload[j]=new Image()
FishPreload[j].src=eval("FishPath+FishName[i]+'_r.gif'")
j++
}
function CheckLoad(){
var isLoaded=true
for(i=0;i<FishPreload.length;i++){
if(FishPreload[i].readyState!="complete")
isLoaded=false
}
if(isLoaded){
ApplyFish()
Loading.style.display="none"
}else{
LoadingDots.innerHTML=(LoadingDots.innerHTML=="....")?"":LoadingDots.innerHTML+"."
setTimeout("CheckLoad()",300)
}
}
function Property(){ //赋予每条鱼新属性。
this.Name=FishName[i]
this.T_Margin
this.L_Margin
this.B_Margin
this.R_Margin
this.SwinDown
this.SwinRight
this.V_Speed
this.H_Speed
return this
}
function SwinAway(n){ //滑鼠碰触到鱼时迅速离开。
FishProp[n].V_Speed=4
FishProp[n].H_Speed=8
}
function SwinControl(){ //由於是用乱数决定游动位置,偶尔会发生鱼群叠成一堆的状况。
for(i=0;i<FishProp.length;i++){
with(eval('fish_'+i).style){
posTop =(FishProp[i].SwinDown)?posTop+FishProp[i].V_Speed:posTop-FishProp[i].V_Speed
posLeft=(FishProp[i].SwinRight)?posLeft+FishProp[i].H_Speed:posLeft-FishProp[i].H_Speed
if(eval('fish_'+i).offsetTop>=FishProp[i].B_Margin){FishProp[i].SwinDown=false}
if(eval('fish_'+i).offsetTop<=FishProp[i].T_Margin){FishProp[i].SwinDown=true}
if(eval('fish_'+i).offsetLeft>=FishProp[i].R_Margin){
FishProp[i].SwinRight=false
eval('fish_'+i).src=eval("FishPath+FishProp[i].Name+'_l.gif'")
}
if(eval('fish_'+i).offsetLeft<=FishProp[i].L_Margin){
FishProp[i].SwinRight=true
eval('fish_'+i).src=eval("FishPath+FishProp[i].Name+'_r.gif'")
}
}
}
}
function ActiveProperty(){
for(i=0;i<FishProp.length;i++){
FishProp[i].T_Margin=Math.floor(Math.random()*(FishJar.clientHeight-eval('fish_'+i).offsetHeight-120)) //总高度减 120 鱼才不会贴地游
FishProp[i].B_Margin=FishProp[i].T_Margin+eval('fish_'+i).offsetHeight
FishProp[i].L_Margin=Math.floor(Math.random()*(FishJar.clientWidth/2-eval('fish_'+i).offsetWidth*2))
FishProp[i].R_Margin=Math.floor(Math.random()*(FishJar.clientWidth/2-eval('fish_'+i).offsetWidth*2))+(FishJar.clientWidth/2)
FishProp[i].V_Speed =Math.floor(Math.random()*2)
FishProp[i].H_Speed =Math.floor(Math.random()*4)+1
}
setTimeout("ActiveProperty()",6000) //每 6 秒钟改变一次游动的速度与方向。
}
function ApplyFish(){
for(i=0;i<FishName.length;i++){
FishProp[i]=new Property()
var ft=Math.floor(Math.random()*(FishJar.clientHeight-150))+40
var fl=Math.floor(Math.random()*(FishJar.clientWidth-200))+100
FishProp[i].SwinRight=(i%2)?true:false
vd=(i%2)?"r":"l"
FishJar.insertAdjacentHTML("beforeEnd","<img id=\"fish_"+i+"\" src=\""+FishProp[i].Name+"_"+vd+".gif\" onmouseover=\"SwinAway("+i+")\" style=\"position:absolute;top:"+ft+";left:"+fl+"\">")
}
ActiveProperty()
setInterval("SwinControl()",1)
}
window.onload=CheckLoad
document.ondragstart =new Function("return false")
document.onselectstart=new Function("return false")
document.oncontextmenu=new Function("return false")
</script>
你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=3838107
|
- 评论人:天使ηò哭
2006-01-09 10:58:34
|
|||
呵呵,谢谢楼上的,估计你对各浏览器都比较了解了.以前比较烦firefox严重不支持ie能支持的那些特效,还有css代码,现在发现他们的标准对于规范网页方面还是挺好的.很多开发者插件可以选用.不错. |
||||
|
- 评论人:大头
2005-12-20 23:04:40
|
|||
路过,这个问题挺有意思,忍不住小小研究一下,的确,是这里的问题:〈!-- saved from url=(0014)about:internet --〉
|
||||