DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> JavaScript綜合知識 >> JS定時關閉窗口的實例
JS定時關閉窗口的實例
編輯:JavaScript綜合知識     

 代碼如下:


<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>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved