'self.close();'에 해당되는 글 1건

  1. 2009.04.06 창닫기 타이머

창닫기 타이머

Js & Css 2009. 4. 6. 08:59 posted by 무명시인

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AutoClose.aspx.cs" Inherits="Javascript_Etc_AutoClose" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>제목 없음</title>

    <script language="javascript">
    // set time
    var time = 5;
    function checkTime()
    {
        if(time >= 0)
        {
            setTimeout(checkTime, 1000, 1);   
            div.innerText = time + ' second after window close';  
            time--;
        }
        else
        {
            clearTimeout(1);
            self.close();
        }       
    }

    time = 5;
    setTimeout(checkTime, 1000, 1);
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div id="div">
        </div>
    </form>
</body>
</html>