定时60秒自动刷新本网页的js代码

2025年6月7日

<div id=”countdown”>60</div>
<script>
let seconds = 60;
const countdownElement = document.getElementById(“countdown”);
function updateCountdown() {
countdownElement.textContent = seconds;
if (seconds <= 0) {
clearInterval(timer);
location.reload();
} else {
seconds–;
}}
updateCountdown();
const timer = setInterval(updateCountdown, 1000);
</script>

定时60秒刷新网页的js代码。实测功能正常,特此记之20250607