利用php与js来轻松实现页面数据的刷新
发布时间:2022-03-12 16:45:23 所属栏目:PHP教程 来源:互联网
导读:利用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; stat
利用"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>/""; ?> (编辑:湘西站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |