|
利用"XXXX.htm"和"XXX.php"兩個(gè)文件來(lái)實(shí)現(xiàn)數(shù)據(jù)的刷新
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>/"";
?>
php技術(shù):利用php和js實(shí)現(xiàn)頁(yè)面數(shù)據(jù)刷新,轉(zhuǎn)載需保留來(lái)源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。