我是靠谱客的博主 畅快钻石,这篇文章主要介绍JS定时关闭窗口的实例,现在分享给大家,希望可以做个参考。

复制代码 代码如下:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type ="text/css" >
    .main{ background-color:Silver; width :200px; height :100px; margin-left:40%; margin-top :200px; text-align :center;}
    </style>
    <script src="js/ui/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        var n = 3;
        function showTime() {
            n--;
            $('#divMain').html(n + ' 秒后关闭窗口');
            if (n == 0)
                window.close();
            else
                setTimeout('showTime()', 1000);
        }
    </script>
</head>
<body onload ="showTime()">
    <form id="form1" runat="server">
    <div id ="divMain" class ="main" >

    </div>
    </form>
</body>
</html>

最后

以上就是畅快钻石最近收集整理的关于JS定时关闭窗口的实例的全部内容,更多相关JS定时关闭窗口内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(131)

评论列表共有 0 条评论

立即
投稿
返回
顶部