如何让计时器以html格式打开另一个html文件

如何让计时器以html格式打开另一个html文件,html,file,timer,Html,File,Timer,因此,我无法找到如何在一定时间后从html文件打开另一个html文件! 我的文件名是homepagewebsite.html,但我希望它打开menu.html 请帮忙 使用JavaScript,如下所示: 比如:homepagewebsite.html <body onload=startTimer();> <script> function startTimer(){ var tt = setInterval(function() { window.open (

因此,我无法找到如何在一定时间后从html文件打开另一个html文件! 我的文件名是homepagewebsite.html,但我希望它打开menu.html


请帮忙

使用JavaScript,如下所示:

比如:homepagewebsite.html

<body onload=startTimer();>
<script>
function startTimer(){
var tt = setInterval(function() {
    window.open ('menu.html','_self',false)
},5000);
}
</script>
<html>
<body>
   New page
</body>
</html>

函数startTimer(){
var tt=setInterval(函数(){
window.open('menu.html','u self',false)
},5000);
}
menu.html

<body onload=startTimer();>
<script>
function startTimer(){
var tt = setInterval(function() {
    window.open ('menu.html','_self',false)
},5000);
}
</script>
<html>
<body>
   New page
</body>
</html>

新页

var iframe=window.getElementsByTagName(“iframe”)[0];
警报(“帧标题:+iframe.contentWindow.title”);
您的浏览器不支持iFrame

在另一个选项卡中打开iframe内部的链接

<base target="_blank" />
<iframe width="400" height="215" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"
   src="https://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=es-419&amp;geocode=&amp;q=buenos+aires&amp;sll=37.0625,-95.677068&amp;sspn=38.638819,80.859375&amp;t=h&amp;ie=UTF8&amp;hq=&amp;hnear=Buenos+Aires,+Argentina&amp;z=11&amp;ll=-34.603723,-58.381593&amp;output=embed">
</iframe><br />
<small>
    <a href="https://maps.google.com/maps?f=q&amp;source=embed&amp;hl=es-419&amp;geocode=&amp;q=buenos+aires&amp;sll=37.0625,-95.677068&amp;sspn=38.638819,80.859375&amp;t=h&amp;ie=UTF8&amp;hq=&amp;hnear=Buenos+Aires,+Argentina&amp;z=11&amp;ll=-34.603723,-58.381593"
       style="color:#0000FF;text-align:left">
        See bigger map
    </a>
</small>



只需检查SmoothState.js是否为liabrary即可打开html页面而无需刷新页面,如果您在jQuery中表现出色,则可以添加点击计时器事件,当点击注册到DOM时,DOM会等待几秒钟,然后SmoothState.js打开下一个html页面


谢谢!它起作用了,但是我怎么改变它的时间呢?把5000换成你想要的<代码>>,5000)这里。