<p ><span id="span">5</span>秒后进入主页....</p> <script> var number = 5; var span = document.getElementById("span"); function get() { number--; if(number <= 0){ location.href="https://www.baidu.com"; } span.innerHTML=number + ""; } setInterval(get,1000);
</script>