웹마스터 팁

모두 시간 지정 가능한 것입니다.

예전에 팝업공지창 띄우는 소스 올렸었는데
어떤분이 2개 이상 띄우는것 요청해주셔서 올립니다.
질문은 가급적이면 제 홈페이지(아래 원문 링크)로 와서 해주세요(다운가능)~ 시간이 많이 지나 질문해주시면 저는 모른답니다 -,-;

원문 : http://lemin.net/bbs/zboard.php?id=js_source&page=1&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=7

--------------------------------------------------------------------------------------------------------------------------------------
기존에 올려놨던 자료를 수정했습니다.
팝업창 두개가 아니라 원하는대로 띄울 수 있습니다.
편집하기 편하게 파일을 분리시켰으니 편하게 쓰실 수 있습니다.

파일 구성은 다음과 같습니다.
index.html ->팝업창을 띄우는 명령을 하는 창(이 index.html이 script01.js와 script02.js를 불러옵니다)
script01.js -> 1번 팝업창을 띄우는 자바스크립트
script02.jg -> 2번 팝업창을 띄우는 자바스크립트
popup01.html -> 1번 팝업창
popup02.html -> 2번 팝업창

script01.js와 script02.js 를 비교하시면 뭐가 틀린지 금방 아실 수 있습니다.
popup01.html과 popup02.html도 비교하시면 금방 아실 수 있을거구요.
원하는대로 수정해서 쓰시면 됩니다.
index.html--------------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>무제 문서</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language='javascript' src='script01.js'></script>
<script language='javascript' src='script02.js'></script>
</head>

<body>
메인창(창을 띄우도록 명령하는 창) - 2개의 팝업창 띄우기

</html>




script01.js-------------------------------------------------------------------------------------------------------------------------------
<!--
function change(form)
{
if (form.url.selectedIndex !=0)
parent.location = form.url.options[form.url.selectedIndex].value
}
function setCookie( name, value, expiredays )
{
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function getCookie( name )
{
        var nameOfCookie = name + "=";
        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 "";
}
if ( getCookie( "Notice" ) != "done" )
{
        noticeWindow  =  window.open('popup01.html','notice','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=395,height=285');//이부분을 자기에 맞게 변경하세요
        noticeWindow.opener = self;
}
// -->




script02.js-------------------------------------------------------------------------------------------------------------------------------
<!--
function change(form)
{
if (form.url.selectedIndex !=0)
parent.location = form.url.options[form.url.selectedIndex].value
}
function setCookie( name, value, expiredays )
{
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function getCookie( name )
{
        var nameOfCookie = name + "=";
        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 "";
}
if ( getCookie( "Notice2" ) != "done" )
{
        noticeWindow  =  window.open('popup02.html','notice2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=295,height=385');//이부분을 자기에 맞게 변경하세요
        noticeWindow.opener = self;
}
// -->




popup01.html------------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>::알림::</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<SCRIPT language="JavaScript">
<!--

function setCookie( name, value, expiredays )
    {
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
        }

function closeWin()
{
        if ( document.forms[0].Notice.checked )


                setCookie( "Notice", "done" , 1); //1이란 숫자는 1일간 안보임을 뜻합니다. 날짜는 자신에 맞게 수정하세요

        self.close();
}
// -->
</SCRIPT>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table cellspacing="0" cellpadding="0" border="0">
  <tr>
    <td align="center" height=70>팝업창 1</td>
  </tr>
  <tr>
    <td height="40" align="center">
     <form>
        <input type="checkbox" name="Notice" value="">앞으로 창 표시하지 않음.  
        닫기
      </form>
    </td>
  </tr>
</table>

</html>




popup02.html------------------------------------------------------------------------------------------------------------------------------
<html>
<head>
<title>::알림::</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<SCRIPT language="JavaScript">
<!--

function setCookie( name, value, expiredays )
    {
        var todayDate = new Date();
        todayDate.setDate( todayDate.getDate() + expiredays );
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
        }

function closeWin()
{
        if ( document.forms[0].Notice2.checked )


                setCookie( "Notice2", "done" , 1); //1이란 숫자는 1일간 안보임을 뜻합니다. 날짜는 자신에 맞게 수정하세요

        self.close();
}
// -->
</SCRIPT>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table cellspacing="0" cellpadding="0" border="0">
  <tr>
    <td align="center" height=70>팝업창2</td>
  </tr>
  <tr>
    <td height="40" align="center">
     <form>
        <input type="checkbox" name="Notice2" value="">앞으로 창 표시하지 않음.  
        닫기
      </form>
    </td>
  </tr>
</table>

</html>

제목 글쓴이 날짜
공중에 이리저리 떠다니는 레이어 [2] 아벨라 2002.10.13
문자열 길이(byte)에 따라 자르기... 행복한고니 2002.10.11
크롬리스 윈도우창 띄우기 [21] 臥龍先生 2002.10.09
Select의 값을 iframe으로 넣는것입니다. [3] ZipShin 2002.10.03
엔지오 메인 화면에서 배너 클릭하면 뜨는 프롬프트 달기 [1] Eccen 2002.09.30
크롬리스 인터6.0 sp1인한 문제 수정패치 [1] 이태운 2002.09.29
페이지 맨위로 이동하는 top 버튼 [7] 조정환 2002.09.28
자바스크립트로 클릭하면 출력되는 메뉴를 만들어 보자~!!! [6] 유지호 2002.09.20
간단하고 빠른 페이지포워딩 [3] Draco 2002.09.19
asx파일 만들어 나만의 뮤직비디오 만들기 [5] zinie 2002.09.19
개판 오분전 넷 비디오 [1] 미친개 2002.09.19
타이틀 바 마퀴 소스 [2] 미친개 2002.09.18
자바스크립트로 여러개 아이디 로그인 하기 [5] ZipShin 2002.09.17
원하는곳에 배경그림고정 [1] 아벨라 2002.09.17
문서중 http://***.*** 에 자동링크 - 이제 서버측에서 하지 마세요.. [9] 정명주 2002.09.04
[re] 문서중 http://***.*** 에 자동링크 ~ 저도 한번 해봤습니다.. [3] 점퍼워니 2002.09.05
브라우저 언어에 따라 다른 페이지 보이기 [11] 써니얌 2002.09.03
접속하자 마자 풀스크린으로 바뀌는 홈페이지만들기 [20] 노명수 2002.09.02
[기본] 글씨 꾸미기 ^ㅡ^; [13] 2002.08.24
원하는 위치에서 스크롤바를 부드럽게 따라다님 [10] ▩윤미 2002.08.20