Js 倒计时跳转

<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>

 

posted @ 2017-04-06 17:14  微笑代表淡定.Net  阅读(139)  评论(0编辑  收藏  举报