将这个脚本里面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