메뉴 건너뛰기

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)
박영식 (비회원)
    • 글자 크기
[fla] flash lite1.1 로 만든 SKY용 시계플래시(240X370) 2 (by 박영식) [유틸] 디지털카메라용 SD 카드 복원 (by 박영식)

댓글 달기

번호 제목 글쓴이 날짜 조회 수
32 [유틸] 읽기 전용 설정 디렉터리/파일 이동 박영식 2011.11.21 8616
31 혈액관리법시행규칙개정_보도자료(최종) 박영식 2008.04.09 8616
30 php용 rss리더기 박영식 2007.07.28 8552
29 Windows vista sidebar에 IBM DW RSS 넣기 박영식 2008.06.22 8531
28 [swf] 플래시 lite 1.1 용 달력 박영식 2009.07.03 8507
27 xp용 비스타 테마 파일들 박영식 2007.11.05 8477
26 전자산업기사 기출문제 2003-1 박영식 2006.03.30 8444
25 [VS] 압축 / 해제 소스코드 박영식 2011.11.22 8439
24 전자산업기사 기출문제 2003-4 박영식 2006.03.30 8423
23 [fla] flash lite1.1 로 만든 SKY용 시계플래시(240X370) 2 박영식 2009.06.18 8414
쿠키로 새창 열림 여부 정하기 박영식 2002.06.22 8372
21 [유틸] 디지털카메라용 SD 카드 복원 박영식 2011.11.21 8308
20 [XE] 다른 XE에 글 전송 애드온 lispro06 2014.01.13 8220
19 전자산업기사 기출문제 2004-2 박영식 2006.03.30 8198
18 전자산업기사 기출문제 2005-4b 박영식 2006.05.28 8145
17 전자산업기사 기출문제 2004-1 박영식 2006.03.30 8118
16 전자산업기사 기출문제 2003-2 박영식 2006.03.30 8090
15 전자산업기사 기출문제 2005-2 박영식 2006.03.30 7940
14 전자산업기사 기출문제 2004-4 박영식 2006.03.30 7681
13 전자산업기사 기출문제 2005-1 박영식 2006.03.30 7512
첨부 (0)
위로