我想在一段特定的时间后加载另一个HTML页面

ash*_*209 63 html javascript timer

我有一个html页面"form1.html",它有一个动画图像.我想在5秒后加载另一个页面"form2.html".我该怎么做呢?

Wal*_*alu 56

<script>setTimeout(function(){window.location.href='form2.html'},5000);</script>
Run Code Online (Sandbox Code Playgroud)

并且对于主页仅添加'/'

<script>setTimeout(function(){window.location.href="/"},3000);</script>
Run Code Online (Sandbox Code Playgroud)


Maj*_*our 18

<meta http-equiv="refresh" content="5;URL='form2.html'">
Run Code Online (Sandbox Code Playgroud)


meh*_*hdi 16

使用此JavaScript代码:

<script>
    setTimeout(function(){
       window.location.href = 'form2.html';
    }, 5000);
</script>
Run Code Online (Sandbox Code Playgroud)