javascript10秒後跳轉到一個網頁同時顯示一個倒計時
<html>
<head>
<script>
var count = 10;
var timer = setInterval(function() {
count--;
document.getElementById("countdown").innerHTML = count;
if (count == 0) {
clearInterval(timer);
window.location.href = "https://www.google.com";
}
}, 1000);
</script>
</head>
<body>
<p>跳轉中,倒計時 <span id="countdown">10</span> 秒</p>
</body>
</html>
原文地址: https://www.cveoy.top/t/topic/bcRg 著作权归作者所有。请勿转载和采集!