js实现5秒倒计时后跳转页面

<script type="text/javascript">
        function countDown(secs, surl) {
            var jumpTo = document.getElementById('jumpTo');
            jumpTo.innerHTML = secs;
            if (--secs > 0) {
                setTimeout("countDown(" + secs + ",'" + surl + "')", 1000);
            }
            else {
                location.href = surl;
            }
        }     
</script>


使用方法:cz0网页模板,帝国cms模板,网站模板免费下载,做网站首选站长魔吧
 
<div>发生错误,<span id="jumpTo">5</span>秒后自动跳转到首页,返回后请联系客服!</div>
<script type="text/javascript">
countDown(5, '/index.html');
</script>