And*_*ore 50
以下JavaScript代码段允许您在给定时间刷新:
function refreshAt(hours, minutes, seconds) {
var now = new Date();
var then = new Date();
if(now.getHours() > hours ||
(now.getHours() == hours && now.getMinutes() > minutes) ||
now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
then.setDate(now.getDate() + 1);
}
then.setHours(hours);
then.setMinutes(minutes);
then.setSeconds(seconds);
var timeout = (then.getTime() - now.getTime());
setTimeout(function() { window.location.reload(true); }, timeout);
}
Run Code Online (Sandbox Code Playgroud)
然后,您可以添加脚本标记来调用该refreshAt()函数.
refreshAt(15,35,0); //Will refresh the page at 3:35pm
Run Code Online (Sandbox Code Playgroud)
<META HTTP-EQUIV="Refresh" CONTENT="5">
Run Code Online (Sandbox Code Playgroud)
这将迫使页面每5秒重新加载一次.只需计算正确的间隔并将其添加到内容标记
| 归档时间: |
|
| 查看次数: |
44697 次 |
| 最近记录: |