[JS] 오늘 하루 열지 않음

팝업창 스크립트

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!--
//*****    쿠키저장 지정시간동안 나오지 않음
function notice_setCookie( name, value, expiredays )
{
    var todayDate = new Date();
    todayDate.setTime(todayDate.getTime()+1000*60*60*12*expiredays);
    document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
 
//*****    쿠키저장하면서 닫기
function notice_closeWin()
{
    notice_setCookie( "aniv", "done" , 1); // 1=하룻동안 공지창 열지 않음
    top.close();
}
 
// - JavaScript - -->

메인 윈도우 스크립트

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!--
function notice_getCookie( name )
{
    var nameOfCookie = name + "=";
    var x = 0;
    while ( x <= document.cookie.length )
    {
        var y = (x+nameOfCookie.length);
        if ( document.cookie.substring( x, y ) == nameOfCookie ) {
            if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
            endOfCookie = document.cookie.length;
            return unescape( document.cookie.substring( y, endOfCookie ) );
        }
        x = document.cookie.indexOf( " ", x ) + 1;
        if ( x == 0 )
        break;
    }
    return "";
}
 
if ( notice_getCookie( "aniv" ) != "done" )
{
    window.open("/popups/060926.html","popups","width=450,height=700,scrollbars=no")
}
//-->

Leave a Reply