웹마스터 팁
page_full_width">
팝업공지창 2개이상 띄우기(시간제한 가능)
2004.03.23 19:54
모두 시간 지정 가능한 것입니다.
예전에 팝업공지창 띄우는 소스 올렸었는데
어떤분이 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개 이상 띄우는것 요청해주셔서 올립니다.
질문은 가급적이면 제 홈페이지(아래 원문 링크)로 와서 해주세요(다운가능)~ 시간이 많이 지나 질문해주시면 저는 모른답니다 -,-;
원문 : 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>
댓글 8
-
9000㎒
2004.03.25 17:18
원본 주소의 마우스 커서가 저따구로 되는거 싫어하는 본인 [-_-] -
lemin
2004.03.26 09:47
저따구로? 말씀심하시네요 -
TimelessTime
2004.03.28 22:49
저따구라도 이쁘네요^^ 말씀은 가려가면서 하시는게,.,. -
DaiSeuki
2004.04.05 07:45
http://sayq.org/
지나친 마퀴태그 사용-_- 짜증나죠-_-
스크롤바도 배경색과 같게 해둔건 정말 짜증나죠-_-
셀..세로정렬.. 기본값(중간)으로 해둔거 보면 만든사람의 허접함을 느끼죠-_- -
Pw-NET
2004.04.05 13:06
9000Mhz라면 9Ghz라는 ㅡㅡㅋ -
YeUPy
2004.04.05 13:02
자신 뭐하나 제대로 된거 올리지도 못하면서 다른 분이 신경써서 올린 글에
저따구로 말씀하시면 안되죠. 초딩은 마퀴태그나 계속 연습하시면서 매너도 좀 공부하세요. -
šarami
2004.04.05 13:55
9Ghz보다 조금 더 적겠죠 :-S -
김정수
2004.04.07 11:53
팝업창 위치가 겹쳐서 나타나는데 옆에 나란히 딱맞게 할려면 어떻게야하나요?
제목 | 글쓴이 | 날짜 |
---|---|---|
팝업공지창 2개이상 띄우기(시간제한 가능) [8] | lemin | 2004.03.23 |
허접한 풀다운 메뉴 소스입니다. (유용한 팁 일지는 모르겠네요.)
[9]
![]() | 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]
![]() | zero | 2004.03.10 |
보안문서 만들기 [5] | 민우주 | 2004.03.07 |
팝업 창 띄우고 어미창 사라지게 하는 소스 [5] | piasol | 2004.03.06 |
방문자 OS보여주기 [5] | 구조반 | 2004.03.05 |
벅스뮤직 음악듣기 및 시작 정지 버튼 넣기(기타 음악파일도...) [3] | 카멜롯™ | 2004.03.04 |
회원 가입 페이지 이젠 끝이다 [5] | 윌 | 2004.03.03 |
우뚜같은 포워딩 페이지에서 프레임 깨기.(프레임 없애기) [17] | 김영성 | 2004.02.19 |
벅스뮤직 플레이어 스크립트 추출기 [4] | 이녀석 | 2004.02.16 |
XML+JS 연동 다중셀렉트 | 투헤븐 | 2004.02.16 |
BGM Player (배경 음악) [17] | 장진석 | 2004.02.16 |