如何使页面使用户在X秒后跳转到新网页。如果可能的话,我想使用HTML,但一种小气的感觉告诉我,它必须是Javascript。
到目前为止,我得到了以下内容,但它没有时间延迟
<body onload="document.location='newPage.html'">发布于 2008-09-26 13:58:20
元刷新很难看,但可以工作。以下内容将在5秒后转到新的url:
<meta http-equiv="refresh" content="5;url=http://example.com/"/>发布于 2008-09-26 14:01:02
如果您要使用JS路线,只需使用
setTimeout("window.location.href = 'newPage.html';", 5000);发布于 2008-09-26 13:58:25
把这句话放在头上:
<meta http-equiv="refresh" content="5;url=newPage.html">这将在5秒后重定向。设置为0可在加载时重定向。
https://stackoverflow.com/questions/139623
复制相似问题