將這個腳本里面one.html。代碼是不言自明的。
<script>
function redirectToPage2(){
var redirectUrl = "two.html"
message= "You will be redirected to Page 2. Click <a href='"+redirectUrl+"'>here</a> if you are not redirected in 10 seconds.";
$(body).innerHTML=message;
setTimeout(function(){
window.location=redirectUrl;
}, 10000); // will redirect after 10 seconds
}
}
window.onload = redirectToPage2;
</script>
如果你不想看到one.html,你將需要另一個頁面 - 比如說three.html。代碼將如下所示。
One.html
<script>
window.onload = "Three.html";
</script>
並放置在Three.html上面的代碼。
我不想顯示的one.html給用戶的內容,應該就可以顯示一個對話框或警告框消息,用戶可以單擊OK按鈕在10或繼續對話框/提醒框應該自動關閉並顯示two.html頁面。 – user222
請看我答案的第二部分。 –
感謝您的支持,但它不工作,在加載one.html之前它應該顯示帶有消息的對話框,10秒後或用戶單擊確定頁面應該重定向到另一頁面。這是因爲我的舊網頁已被修改爲新頁面,所以當用戶在瀏覽器中給出舊網址時,只想顯示帶有消息的對話框而不加載舊內容,然後顯示新網頁。 – user222