웹마스터 팁

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

예전에 팝업공지창 띄우는 소스 올렸었는데
어떤분이 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>

제목 글쓴이 날짜
[iframe:아이프레임] 내용에 맞게 사이즈 조절하기 한번입력으로 끝.[다른방법:중복아닌듯] [45] beMax 2004.04.23
(For 초보)원클릭으로 여러프레임 컨트롤하기 [2] 쉬드 2004.04.19
자기가 살아온 시간 구하기.. 데스크탑에 나타내기 [4] kein23 2004.04.14
브라우저 버젼별 다른 페이지 보여주기 [2] Kuldahar 2004.04.13
바보같은 MS의 parseInt 버그. [4] 김관석 2004.04.09
XP계열의 방문자 컴에서 ClearType 효과 사용여부 확인 [4] YeUPy 2004.04.04
팝업공지창 2개이상 띄우기(시간제한 가능) [8] lemin 2004.03.23
허접한 풀다운 메뉴 소스입니다. (유용한 팁 일지는 모르겠네요.) [9] file tintintm 2004.03.23
버튼 만들기 [1] 旻天 2004.03.23
MS agent online object - Default Character 인 Merlin Action 추가 [2] 꽃ちゃん 2004.03.19
움직이는 타이틀바 [4] 김동현 2004.03.18
웹브라우저 상태바가 밑으로 내려오는 소스 [5] 프리서버 2004.03.16
브라우져(윈도우) 창의 크기(사이즈)를 조절하는 소스입니다 [5] 나야 2004.03.15
프레임사이트에서 자식 프레임(URL)로 직접 치고 들어 올경우 다시 프레임 부모로 돌려보내는 소스 나야 2004.03.15
전체 include menu 만들기(롤오버 이미지 사용) [4] Neoyoung 2004.03.14
[초간단 자바스크립트!] 서브메뉴 만들기...~ [11] ∑Ztxy 2004.03.10
뉴스티커 [16] file zero 2004.03.10
보안문서 만들기 [5] 민우주 2004.03.07
팝업 창 띄우고 어미창 사라지게 하는 소스 [5] piasol 2004.03.06
방문자 OS보여주기 [5] 구조반 2004.03.05