手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >JS定时关闭窗口的实例
JS定时关闭窗口的实例
摘要:复制代码代码如下:.main{background-color:Silver;width:200px;height:100px;margin...

复制代码 代码如下:

<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+CSS实现的拖动分页效果实例

JavaScript数组去重的3种方法和代码实例

脚本写的IE右键助手

自动关闭的层

JavaScript每天定时更换皮肤样式的方法

根据内容自动调整弹出窗口大小的JS解决方案

JS实现定时自动关闭DIV层提示框的方法

JavaScript函数使用的基本教程

Jquery使用css方法改变样式实例

js实现精美的图片跟随鼠标效果实例

精品推荐
分类导航