簡(jiǎn)單明了代碼
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>跳轉(zhuǎn)提示頁(yè)面</title>
<script type="text/javascript">
? // 倒計(jì)時(shí)跳轉(zhuǎn)
? function countdown() {
? ? var seconds = 5; // 跳轉(zhuǎn)倒計(jì)時(shí)秒數(shù)
? ? var countdownElement = document.getElementById('countdown');
? ? var countdownInterval = setInterval(function() {
? ? ? seconds--;
? ? ? countdownElement.innerText = seconds;
? ? ? if (seconds <= 0) {
? ? ? ? clearInterval(countdownInterval);
? ? ? ? redirectToNewPage();
? ? ? }
? ? }, 1000);
? }
? // 跳轉(zhuǎn)到新頁(yè)面
? function redirectToNewPage() {
? ? window.location.href = "http://idcbgp.cn/";
? }
? // 返回前一個(gè)頁(yè)面
? function goBack() {
? ? window.history.back();
? }
</script>
</head>
<body onload="countdown()">
? <h1>跳轉(zhuǎn)提示頁(yè)面</h1>
? <p>將在 <span id="countdown">5</span> 秒后自動(dòng)跳轉(zhuǎn)到新的地址。</p>
? <button onclick="goBack()">返回</button>
</body>
</html>