利用"xxxx.htm"和"xxx.php"两个文件来实现数据的刷新
xxxx.htm
<head>
<script>
// refresh code
r_s = 0;
timenow = 0;
function calrs()
{
d = new date();
h= d.gethours(); m = d.getminutes(); s = d.getseconds();
if( m < 10) m = '0' + m;
if( s < 10) s = '0' + s;
status = ' ' + h + ":" + m + ":" + s;
r_s = 2000;
}
calrs();
function reload_me()
{
c = document.getelementbyid("reload1");
c.src = "";
c.src = "xxxxx.php?reload=1";
calrs();
settimeout('reload_me()', r_s);
}
// refresh code
settimeout('reload_me()', r_s);
</script>
<script id="reload1"></script>
</head><small>
<div id="p_show></div>
</small>
xxxxx.php
<?php
header("cache-control: no-cache, must-revalidate");
echo "document.all.p_show.innerhtml= /"?<font color=red>".rand(0,9)."</font>/"";
?>
新闻热点
疑难解答