Home > php教程 > php手册 > body text

利用php和js实现页面数据刷新

WBOY
Release: 2016-06-13 12:46:51
Original
1247 people have browsed it

利用"XXXX.htm"和"XXX.php"两个文件来实现数据的刷新

XXXX.htm

<script><BR>// Refresh code<BR>r_s = 0;<BR>timenow = 0;<BR>function calrs()<BR>{<BR> d = new Date();<BR> h= d.getHours(); m = d.getMinutes(); s = d.getSeconds();<br><br> if( m < 10) m = '0' + m;<BR> if( s < 10) s = '0' + s;<BR> status = ' ' + h + ":" + m + ":" + s;<BR> r_s = 2000;<BR>}</script>

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);


 echo "document.all.p_show.innerHTML= \"?".rand(0,9)."\"";
?>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template