2013-03-30 15 views
53

我有一個html頁面「form1.html」,它有一個動畫圖像。我想在5秒後加載另一個頁面「form2.html」。我該怎麼做呢?我想在特定的時間量後載入另一個HTML頁面

+0

爲什麼在問題標題超出jQuery主題時標記jQuery問題的重複? –

+0

看看讓你的第三頁的問題,看起來像的http://stackoverflow.com/questions/503093/how-can-i-make-a-page-redirect-using-jquery/25537534#25537534 –

+1

^聰明的方式接受的答案,其中有8800 upvotes。 – coreyward

回答

49
<script>setTimeout(function(){window.location.href='form2.html'},5000);</script> 

而對於主頁只添加 '/'

<script>setTimeout(function(){window.location.href="/"},3000);</script> 
16
<meta http-equiv="refresh" content="5;URL='form2.html'"> 
13

利用這段JavaScript代碼:

<script> 
    setTimeout(function(){ 
     window.location.href = 'form2.html'; 
    }, 5000); 
</script> 
+1

'TimeOut' =>'Timeout' –

0

使用JavaScript的setTimeout的:

<body onload="setTimeout(function(){window.location = 'form2.html';}, 5000)"> 
相關問題