메뉴 건너뛰기

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 [CD] nrg -> iso 박영식 2009.07.31 9974
111 삼성 노트북 sens s820/s850 윈도우98 디스플레이 사운드 드라이버1 박영식 2009.08.03 9728
110 삼성 노트북 sens s820/s850 윈도우98 디스플레이 사운드 드라이버2 박영식 2009.08.03 9777
109 삼성 노트북 sens s820/s850 윈도우98 디스플레이 사운드 드라이버3 박영식 2009.08.03 10505
108 wma_mp3_converter(wma->mp3) 박영식 2009.08.03 12222
107 [OS] 윈도우 xp 설치를 위한 USB 부트용 프로그램 박영식 2009.08.08 9474
106 [문서] 생명보험 보험료 차등 혜택 박영식 2009.08.12 9102
105 [논문] 웹표준 준수와 다중 플랫폼 지원을 통한 웹사이트 관리 박영식 2009.08.12 9980
104 [메일서버] hMailServer-5.1.2-B346.exe 박영식 2009.08.23 12566
103 [크랙] Windows 7 professional k 인증 크랙 박영식 2009.09.06 22728
102 [크랙] Windows 7 professional k 인증 크랙(2) 박영식 2009.09.06 19471
101 [문서] 친일인명사전 명단 박영식 2009.11.14 8629
100 [서식] APA, MLA 포맷(기본형) 박영식 2009.11.14 13576
99 [자바] java decompiler (자바 디컴파일러) 박영식 2009.11.17 10197
98 [XE] 통계용 모듈과 플러그인 박영식 2010.01.12 9574
97 testdisk 파티션복구 프로그램 박영식 2010.01.21 9957
96 [기출문제] 정보처리기사 2005-4 ~2007~4 박영식 2010.04.02 9578
95 [폰트] 휴먼명조 유사체 박영식 2010.04.08 15425
94 [논문] 모바일 웹에서 제조사 및 원격 제어 앱 입력 식별에 관한 실증적 연구 suritam9 2020.10.19 74
93 정보처리기사 실기기출문제(2005-4~2009-2) 박영식 2010.05.19 12210
첨부 (0)
위로