메뉴 건너뛰기

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)
박영식 (비회원)
    • 글자 크기
db에서 회원정보 추출하기 (by 박영식) date() 함수와 옵션사용하기, db에서 특정부분 얻기 (by 박영식)

댓글 달기

번호 제목 글쓴이 날짜 조회 수
112 php의 외부로그인 설치 박영식 2002.04.21 10580
111 db에서 회원정보 추출하기 박영식 2002.06.22 9335
쿠키로 새창 열림 여부 정하기 박영식 2002.06.22 8372
109 date() 함수와 옵션사용하기, db에서 특정부분 얻기 박영식 2002.12.11 10340
108 new이미지 얻기 박영식 2002.12.11 11691
107 php 주요 함수 박영식 2003.12.25 10870
106 엥.. file에서 bit단위로 읽어서, 비교하는 코드 박영식 2003.12.25 9117
105 전자산업기사 기출문제 2002-1 박영식 2006.03.30 10776
104 전자산업기사 기출문제 2002-2 박영식 2006.03.30 10347
103 전자산업기사 기출문제 2002-4 박영식 2006.03.30 9799
102 전자산업기사 기출문제 2003-1 박영식 2006.03.30 8444
101 전자산업기사 기출문제 2003-2 박영식 2006.03.30 8090
100 전자산업기사 기출문제 2003-4 박영식 2006.03.30 8423
99 전자산업기사 기출문제 2004-1 박영식 2006.03.30 8118
98 전자산업기사 기출문제 2004-2 박영식 2006.03.30 8198
97 전자산업기사 기출문제 2004-4 박영식 2006.03.30 7681
96 전자산업기사 기출문제 2005-1 박영식 2006.03.30 7512
95 전자산업기사 기출문제 2005-2 박영식 2006.03.30 7940
94 전자산업기사 기출문제입니다. 박영식 2006.03.30 8768
93 전자산업기사 기출문제 2005-4b 박영식 2006.05.28 8145
첨부 (0)
위로