<h2>
<span id="container">5</span>秒钟后页面即将跳转
</h2>
<script>
let num = 5;
var clock = setInterval(function() {
num = --num;
if (num <= 0) {
clearInterval(clock)
location = 'http://www.baidu.com'
}
document.getElementById('container').innerHTML = num
}, 1000)
</script>