웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
팝업공지창 다시 안뜨게 하는 소스[날짜지정가능]
2003.11.20 11:38
확실히 되는 소스입니다.
예시될 만한 사이트라곤 제가 돈받고 맹근 홈피밖에 없어서 예시는 생략합니다.
팝업을 "띄우는" 명령을 해주는 메인페이지와 팝업공지가 "뜬" 팝업창, 이 두군데에 각각 들어갑니다.
디자인은 각자에 맞게 하세요.
[수정,추가사항]
자스 코드에 보면 날짜지정할 수 있는 부분이 있습니다.
이 부분이 설명이 빠져서 다시 수정합니다.
쭉 내려서 보시다 보면 팝업창 스크립트에서 그 부분에 주석 달아놨으니 원하시는대로 변경하여 쓰세요^^
메인창의 헤드부분-------------------------------------------------------------------
<SCRIPT LANGUAGE="JavaScript">
<!--
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('popup.html','notice','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=395,height=285');//이부분을 자기에 맞게 변경하세요
noticeWindow.opener = self;
}
// -->
</SCRIPT>
팝업창 -------------------------------------------------------------------------------
<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>공지내용</td>
</tr>
<tr>
<td height="40" align="center">
<form>
<input type="checkbox" name="Notice" value="">앞으로 창 표시하지 않음.
<a href="#" onClick="javascript:history.onclick=closeWin()">닫기</a>
</form>
</td>
</tr>
</table>
</body>
</html>
예시될 만한 사이트라곤 제가 돈받고 맹근 홈피밖에 없어서 예시는 생략합니다.
팝업을 "띄우는" 명령을 해주는 메인페이지와 팝업공지가 "뜬" 팝업창, 이 두군데에 각각 들어갑니다.
디자인은 각자에 맞게 하세요.
[수정,추가사항]
자스 코드에 보면 날짜지정할 수 있는 부분이 있습니다.
이 부분이 설명이 빠져서 다시 수정합니다.
쭉 내려서 보시다 보면 팝업창 스크립트에서 그 부분에 주석 달아놨으니 원하시는대로 변경하여 쓰세요^^
메인창의 헤드부분-------------------------------------------------------------------
<SCRIPT LANGUAGE="JavaScript">
<!--
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('popup.html','notice','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=395,height=285');//이부분을 자기에 맞게 변경하세요
noticeWindow.opener = self;
}
// -->
</SCRIPT>
팝업창 -------------------------------------------------------------------------------
<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>공지내용</td>
</tr>
<tr>
<td height="40" align="center">
<form>
<input type="checkbox" name="Notice" value="">앞으로 창 표시하지 않음.
<a href="#" onClick="javascript:history.onclick=closeWin()">닫기</a>
</form>
</td>
</tr>
</table>
</body>
</html>
댓글 17
제목 | 글쓴이 | 날짜 |
---|---|---|
트랙백 구현하기 - 2. 트랙백의 형식 | TheMics | 2004.04.22 |
트랙백 구현하기 - 2. 트랙백의 형식 | TheMics | 2004.04.22 |
PHP5 RC2 Released. [4] | 써니루루☆ | 2004.04.27 |
PHP 4에서 PHP 5로 이행 [5] | 이종현 | 2004.04.30 |
포털사이트 처럼 시스템 점검중 만들기 [3] | http://zentoo.com | 2004.05.14 |
팁 아닌 팁 한달전... | http://zentoo.com | 2004.05.15 |
[국밥PHP] 1-1(1). 개념정리 Break Time (Build 1) [7] | 9000㎒ | 2004.05.18 |
PHP로 구현하는 음악 감상실 [9] | 컴도미 | 2004.05.21 |
초간단 설문조사 소스 [3] | 이혁 | 2004.05.27 |
해당 ftp 파일 서버에서 다른곳의 ftp 파일 서버로 백업용도 및 전송하기.. [9] | 김동욱 | 2004.05.30 |
초간단 스팸방지 하면서 곧바로 메일 보내기 [3] | U2em | 2004.05.31 |
윈도우계정에서 현재 남은 용량과 DB 용량 알기 [6] | 지으니 | 2004.05.31 |
주식정보출력코드 [2] | 김재경 | 2004.06.01 |
1. 연산자 [2] | 티다 | 2004.06.02 |
2. array [5] | 티다 | 2004.06.02 |
게시판내용에 코멘트를 달자!! [3] | 헉스 | 2004.06.02 |
게시판내용에 코멘트를 달자!! -2- [1] | 헉스 | 2004.06.02 |
게시판내용에 코멘트를 달자!! -마지막- [2] | 이혁 | 2004.06.03 |
응용편 - BMI 측정 테스트 소스를 만들어보자 [5] | 티다 | 2004.06.04 |
3. if문 [13] | 티다 | 2004.06.05 |