메뉴 건너뛰기

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)
박영식 (비회원)
    • 글자 크기
파일의 시스템 속성을 바꿀 수 있는 프로그램 (by 박영식) 정보처리기사 실기기출문제(2005-4~2009-2) (by 박영식)

댓글 달기

번호 제목 글쓴이 날짜 조회 수
112 혈액관리법시행규칙개정_보도자료(최종) 박영식 2008.04.09 8616
111 파일의 시스템 속성을 바꿀 수 있는 프로그램 박영식 2007.12.14 9145
쿠키로 새창 열림 여부 정하기 박영식 2002.06.22 8372
109 정보처리기사 실기기출문제(2005-4~2009-2) 박영식 2010.05.19 12210
108 전자산업기사 기출문제입니다. 박영식 2006.03.30 8768
107 전자산업기사 기출문제 2006-1 박영식 2006.06.17 8947
106 전자산업기사 기출문제 2005-4b 박영식 2006.05.28 8145
105 전자산업기사 기출문제 2005-2 박영식 2006.03.30 7940
104 전자산업기사 기출문제 2005-1 박영식 2006.03.30 7512
103 전자산업기사 기출문제 2004-4 박영식 2006.03.30 7681
102 전자산업기사 기출문제 2004-2 박영식 2006.03.30 8198
101 전자산업기사 기출문제 2004-1 박영식 2006.03.30 8118
100 전자산업기사 기출문제 2003-4 박영식 2006.03.30 8423
99 전자산업기사 기출문제 2003-2 박영식 2006.03.30 8090
98 전자산업기사 기출문제 2003-1 박영식 2006.03.30 8444
97 전자산업기사 기출문제 2002-4 박영식 2006.03.30 9799
96 전자산업기사 기출문제 2002-2 박영식 2006.03.30 10347
95 전자산업기사 기출문제 2002-1 박영식 2006.03.30 10776
94 자료실입니다. acroedite 박영식 2009.03.16 9823
93 음절빈도 계산 프로프램 소스2 박영식 2008.09.22 12384
첨부 (0)
위로