html/php页面需要重定向到另一个html/php页面,该页面应保持打开一定的时间间隔。然后,它需要将自己还原为原始状态。
<meta http-equiv="refresh" content="1;URL='TV_moem_ruki.php'" />
在页面加载后立即重定向。
header( "Location: TV_moem_ruki.php") ;
插入到下面的脚本中,它会在某个时间点刷新页面,但是它不起作用。
<script>
refreshAt(13,10,0); //Will refresh the page at 11:05am
</script>
<script>
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);
header( "Location: TV_moem_ruki.php") ;
}
</script>
您可以通过几种方式做到这一点,通过将此代码粘贴到第二页(只保持打开几秒钟的页面):
<meta http-equiv="refresh" content="{numberOfSeconds}; url='TV_moem_ruki.php'" />
或javascript
window.setTimeout(function () {
window.location.href = 'TV_moem_ruki.php'
}, numberOfSeconds * 1000)
假设TV_moem_ruki.php
是您需要返回的第一页。