본문 바로가기

Web/Javascript

팝업창 관련

cookieName = document.cookie;
function openWin(filename,p_width,p_height,scrll) {
    var clk='n';
    if (clk=='y') {
        win1 = window.open(filename, "openwin","resizable=no,scrollbars="+scrll+",width="+p_width+",height="+p_height);
    }
    else {
        if (cookieName.indexOf("Notice1")==-1) {
            win1 = window.open(filename, "openwin","resizable=no,scrollbars="+scrll+",width="+p_width+",height="+p_height);
        }
    }
}


<html>
<head>
<title>추석 잘 보내세요 </title>
<STYLE>
            <!--
            a:link { color:#444444;text-decoration:none; }
            a:visited { color:#444444;text-decoration:none; }
            a:hover { color:#FE017E;text-decoration:underline;}
            body {font-size:9pt;font-family:굴림;color:#444444;line-height:160%;}
            td {font-size:9pt;font-family:굴림;color:#444444;line-height:160%;}
            input {font-size:9pt;font-family:굴림;color:#444444;line-height:100%;}
            -->
</STYLE>
<script>     
            var height = screen.height;
            var width = screen.width;
            var leftpos = width/2-480;
            var toppos = height/2-300;
            self.moveTo(leftpos, toppos);
        
            function notice_setCookie( name, value, expiredays ){
                var todayDate = new Date();
                todayDate.setDate( todayDate.getDate() + expiredays );
                document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
            }

            function closeWin(){
                if ( document.forms[0].Notice1.checked )
                notice_setCookie( "Notice1", "done" , 1);
                self.close();
            }
        </script>


</head>
<body leftmargin="0" topmargin="0" >
<table cellpadding="0" cellspacing="0">
<form name="Fclose">
<tr>
    <Td><a href="javascript:self.close();"><img src="/popup/200412273.gif" border="0"></a></td>
    <!--<Td><a href="javascript:close()"><img src="images/pop.jpg" border="0"></a></td>-->
</tr>
<tr>
        <Td align="center" bgcolor="ffffff" width="470" ><input type="checkbox" name="Notice1"><a href="javascript:closeWin();">오늘 하루 이 창 열지 않기!    </a><br></td>
    </tr>
</table>
</body>
</html>

'Web > Javascript' 카테고리의 다른 글

탑(Top) 버튼  (0) 2013.09.26
document.body  (0) 2013.09.26
getObjectXY  (0) 2013.09.26
동적 그래프  (0) 2013.09.26
iframe 을 이용한 submit 하기  (0) 2013.09.26