分享一段倒计时跳出本站的代码,在5秒后跳转到指定域名:
<div id="wrap"> <div class="errormod"> <h1 style="text-align: center;"><strong>网页出错</strong>抱歉,您所查看的页面无法浏览或已不存在。<span id="totalSecond">5</span><em>秒</em>后跳转到首页。</h1> </div> <!--定义js变量及方法--> <script language="javascript" type="text/javascript"> var second = document.getElementById('totalSecond').textContent; if (navigator.appName.indexOf("Explorer") > -1) { second = document.getElementById('totalSecond').innerText; } else { second = document.getElementById('totalSecond').textContent; } setInterval("redirect()", 1000); function redirect() { if (second < 0) { <!--定义倒计时后跳转页面--> location.href = 'http://您的域名/'; } else { if (navigator.appName.indexOf("Explorer") > -1) { document.getElementById('totalSecond').innerText = second--; } else { document.getElementById('totalSecond').textContent = second--; } } } </script> </div>