404自动跳转主页的实现

  • Post author:
  • Post category:其他


<script type="text/javascript">
	var num = 5;
	function redirect() {
		num--;
		document.getElementById("num").innerHTML=num;
		if (num < 0) {
			document.getElementById("num").innerHTML = 0;
			location.href = "login.html";
		}
	}
	setInterval("redirect()", 1000);
</script>

<body>
	<div class="admin-content">
		<div class="am-cf am-padding">
			<div class="am-fl am-cf">
				<strong class="am-text-primary am-text-lg">404</strong> / <small>That’s an error</small>
			</div>
		</div>

		<div class="am-g">
			<div class="am-u-sm-12">
				<h2 class="am-text-center am-text-xxxl am-margin-top-lg">404. Not Found</h2>
				<p class="am-text-center">
					没有找到你要的页面
				</p>
				<p class="am-text-center">
					<span id="num">5</span>秒后自动跳转到首页<a href="login.html">马上跳转</a>
				</p>
				<pre class="page-404">          .----.
       _.'__    `.
   .--($)($$)---/#\
 .' @          /###\
 :         ,   #####
  `-..__.-' _.-\###/
        `;_:    `"'
      .'"""""`.
     /,  ya ,\\
    //  404!  \\
    `-._______.-'
    ___`. | .'___
   (______|______)
        </pre>
			</div>
		</div>
	</div>
</body>

效果:



版权声明:本文为limenghua9112原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。