我有一个名为status.php 的小php文件
// status.php code
// has background: #cfdeff by style.css
<?php
<html><title>Status</title>
<meta http-equiv="refresh" content="2">
$sql1="select * from blah blah"
.
.
echo $row1[0]
然后我有另一个PHP文件,它有框架。
// code of new.php
<!DOCTYPE html>
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset border="0" cols="85%,15%">
<frame name="left" src="blah.php" />
<frame name="right" src="status.php" />"
<noframes>
<body>
Frame not supported.
</body>
</noframes>
</frameset>
</html>
new.php、status.php和warning.php的背景是蓝绿色
当我从浏览器打开status.php时,一切都很好,页面按预期每2秒刷新一次。
然而,当我从new.php(从我真正想要的地方)打开它时,status.php帧也会像预期的那样每2秒刷新一次,但在刷新(加载所需的时间)之间会有一小段白色背景闪烁
所以当白色背景在原始背景之间闪烁时,它看起来非常难看。
所以有什么可以克服的问题吗?我找了很多,但什么也找不到。
我希望我能让自己理解
谢谢。
试试这个CSS:
frame {
background: none;
}
否则,使帧的背景与主背景相同,如下所示:
frame {
background: /*properties here*/;
}
您无法停止这些闪烁效果。但你可以隐藏它们:
<iframe
width=500px
height=300px
id = 'myFrame'
style='position:absolute;top:0;'
src = 'http://jsfiddle.net/'
>
</iframe>
<div id = 'myLoad'
style='float:top;top:0;
position:absolute;
background-color:#CCC;
min-width:500px;
min-height:300px;
'>
<div style='position:absolute;top:130px;left:200px;'>
<b> Loading... </b>
</div>
</div>
jquery代码:
var ifr = document.getElementById('myFrame');
setFrame();
setInterval(setFrame, 2000);
function setFrame() {
$('#myLoad').fadeIn(200, setAdress);
}
function setAdress() {
ifr.onload=function() { $('#myLoad').fadeOut(200) ;}
ifr.src = 'http://jsfiddle.net/';
}
效果如何
在加载帧之前,将显示一条加载消息。如果帧已加载,则会看到帧