메뉴 건너뛰기

pds

쿠키로 새창 열림 여부 정하기

박영식2002.06.22 16:44조회 수 8372댓글 0

    • 글자 크기
원하는 곳에 삽입하세요.
쿠키를 보고 팝업하게 하는 스크립트입니다.
본문이나, 메뉴에 삽입하는 게 좋겠고,,
robotics 를 다른 것으로 바꾸어 주면 쿠키 생성후에도 다른 이름으로 인식되기 때문에, 또 다른 쿠키가 생성될 때까지 팝업됩니다.
//////////////////////////////////////////////////////////////

<script language="javascript">
<!--        

//버튼의 onfocus event처리
if ( getCookie( "robotics" ) != "done" ) {
  NewOpen();
}

function getCookie( name2 )
{
        var nameOfCookie = name2 + "=";
        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 "";
}

function NewOpen(){
        var file;
        file = "popup.htm";
        if(navigator.appName.indexOf("Netscape") != -1)
                self_awindow = window.open(file,"self_theWindow","toolbar=no,width=372,height=338,status=no,scrollbars=no,resizable=no,menubar=no");
                //self_awindow = window.open(file,"self_theWindow","toolbar=no,width=372,height=338,status=no,scrollbars=no,resizable=no,menubar=no");
        else
                self_awindow = window.open(file,"self_theWindow","toolbar=no,width=300,height=300,status=no,scrollbars=no,resizable=no,menubar=no");
                //self_awindow = window.open(file,"self_theWindow","toolbar=no,width=300,height=300,status=no,scrollbars=no,resizable=no,menubar=no");
}
//-->
</script>

//////////////////////////////////////////////////////////

<SCRIPT language="JavaScript">
function setCookie( name2 )
{
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + 300 );
        document.cookie = name2 + "=" + escape( "done" ) + "; path=/; expires=" + todayDate.toGMTString() +
";"
}

function closeWin()
{
        setCookie( "robotics" );
        self.close();
}
</SCRIPT>

첵크 박스 없이 만들었습니다.
<a onclick="closeWin();" href="">글자 또는 이미지</a>

이런 식으로 하면 되겠습니다.
* 박영식님에 의해서 게시물 이동되었습니다 (2007-01-26 01:06)
박영식 (비회원)
    • 글자 크기

댓글 달기

번호 제목 글쓴이 날짜 조회 수
112 date() 함수와 옵션사용하기, db에서 특정부분 얻기 박영식 2002.12.11 10340
111 db에서 회원정보 추출하기 박영식 2002.06.22 9335
110 expectation maximazation 박영식 2008.09.20 8617
109 httprequest 파일 박영식 2008.01.06 9504
108 ie7설치시 xp 인증 skip reg파일 박영식 2007.03.03 8653
107 log4j 취약점 POC 를 위한 LDAP jar suritam9 2022.09.16 30
106 new이미지 얻기 박영식 2002.12.11 11691
105 nipper-0.11.7 lispro06 2016.01.13 9873
104 peview lispro06 2015.05.15 9948
103 php 주요 함수 박영식 2003.12.25 10870
102 php용 rss리더기 박영식 2007.07.28 8552
101 php의 외부로그인 설치 박영식 2002.04.21 10580
100 sothink swf decompiler 3.3 crack2 박영식 2008.06.06 16469
99 swf를 gif나 avi로 변환하는 프로그램 박영식 2009.06.18 9432
98 testdisk 파티션복구 프로그램 박영식 2010.01.21 9957
97 usb low level formatter lispro06 2015.05.15 12342
96 USB 포맷 안 될 때 lispro06 2017.01.07 12415
95 Vertex algebras, Kac-Moody algebras, and the Monster 박영식 2008.12.06 8839
94 vista와 xp 멀티부팅을 위한 소프트웨어 박영식 2007.12.14 8824
93 windows 7 인증서 오류 인터넷 불가 suritam9 2022.04.30 59
첨부 (0)
위로