代码实现:
<body></body>
内容:
<body>
<div></div>
<script>
var div = document.querySelector('div');
var timer = 5;
fn();
setInterval(fn, 1000);
function fn() {
if (timer == 0) {
location.href = 'https://www.cnblogs.com/jacklzx/';
} else {
div.innerHTML = timer + '秒钟之后跳转到首页';
timer--;
}
}
</script>
</body>