
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
div {
width: 300px;
height: 100px;
line-height: 100px;
text-align: center;
background-color: #abfffa;
border-radius: 10px;
margin: 200px auto;
}
</style>
</head>
<body>
<div></div>
<script>
let div = document.querySelector('div');
let timer = 5;
fn();
setInterval(fn, 1000)
function fn() {
if (timer == 0) {
location.href = 'https://www.cnblogs.com/Eamon-18';
} else {
div.innerHTML = '页面将在' + timer + '秒之后自动跳转';
timer--;
}
}
</script>
</body>
</html>