<script src="~/Scripts/jquery-1.10.2.js"></script> <script type="text/javascript"> $(function () { var i = 5; var intervalid; intervalid = setInterval(Timefun, 1000); function Timefun() { if (i == 0) { window.location.href = "/Home/index"; clearInterval(intervalid); } $("#timeSpan").html(i); i--; } }) </script>
<div> <p style="color:red;">您的访问受限制</p> <p><span id="timeSpan">5</span> 秒后自动跳转... <a href="/Home/Index">跳转</a></p>
</div>