本文介绍了每5分钟自动刷新一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
<html>
<head>
<script language="javascript" src="JS/jQuery.js"></script>
<script>
function page_refresh(){
document.getElementById('form2').action="project_file_dir.cfm"
document.getElementById('form2').submit();
}
</script>
</head>
<body >
<cfoutput>
<cfset fileLocation ="\\squeaker\SiSystemsFile\WebServices\WebSites\Perforce\Bhargavi"> <!--- On mac set to /tmp --->
<cfdirectory
action = "list"
directory = "#fileLocation#"
name = "files"
filter="*.*">
<form method="post" id="form2">
<cfset f="#files.recordcount#">
<cfset mydatetime=now()>
<cfset a=TimeFormat(MyDateTime,'hh:mm:ss tt')>
Total File in <b> #fileLocation# </b> Count is <b> #f# </b> #TimeFormat(MyDateTime,'hh:mm tt')#
<input type="button" name="Refresh" value="refresh" onclick="page_refresh()"><br>
<b>Next Run</b>
<cfset b=TimeFormat(DateAdd('n', +5, MyDateTime),'hh:mm:ss tt')>
#TimeFormat(DateAdd('n', +5, MyDateTime),'hh:mm tt')#
</cfoutput>
<cfset a= Minute(Now())>
<cfset b=a%5 >
<cfoutput>#b#</cfoutput>
<!--- <cfinclude template="page_move_2.cfm"> --->
<cfloop condition="b gt 0">
<cfoutput>inside loop</cfoutput>
<cfset Sleep(6000)>
<cfset b = b - 1 >
</cfloop>
<cfoutput>hi</cfoutput>
</form>
</body>
</html>
我需要每5分钟刷新一次页面。这该怎么做 。我使用了sleep()函数但是在执行sleep()之后加载了ui本身。这个我如何每5分钟重新加载页面
i need to refresh the page for every 5 mins . how to do this . i used sleep() function but ui itself loaded after that sleep() is executed . this me how to reload the page for every 5 mins
推荐答案
使用HTML Meta标签每300秒刷新一次文件页面标签
Refresh document every 300 seconds using HTML Meta tag add this inside the head tag of the page
<meta http-equiv="refresh" content="300">
使用脚本:
setInterval(function() {
window.location.reload();
}, 300000);
这篇关于每5分钟自动刷新一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!