글 수 51
<html>
<body topmargin=0 leftmargin=0>
<tr>
<td>이곳에 팝업내용을 넣어 주세요.</td>
<tr>
<td style='padding-left:10' bgcolor="#E6E6E6" height='24px'>
<INPUT onclick=javascript:history.onclick=closeWin() type=checkbox CHECKED value="0" name=g>
<FONT face=돋움 color=black size=2>오늘 이 창을 띄우지 않겠습니다.</FONT>
</td>
<td style='padding-right:10' bgcolor="#E6E6E6">
<A href="javascript:history.onclick=closeWin()"><img src="button_close.gif" border="0" alt="닫기" align=right></A>
</td>
</tr>
</table>
<script language="JavaScript">
// 쿠키를 만듭니다. 아래 closeWin() 함수에서 호출됩니다
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.all.g.checked )
setCookie( "g", "done" , 2); // 오른쪽 숫자는 쿠키를 유지할 기간을 설정합니다
self.close();
}
function openhref(pPage) {
opener.location.href = pPage
}
</script>
</body>
</html>
위 파일을 popup.html 파일로 저장합니다.
<script language="javascript">
// 쿠키가 있나 찾습니다
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( "g" ) != "done" ) {
window.open('./popup.html','_blank','width=500,height=670,top=50,left=150');
}
</script>위 소스를 홈페이지 index 파일의 <head></head> 사이에 넣어 줍니다.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
제로보드xe의 경우 제가 사용한 방법은...
하단에 불러오는 배너 관련 소스 http://jobdahan.net/zbxe_tip_tech/450888 에서
b_banner.php 파에 해당 스크립트를 <head></head> 사이에 넣어서 처리를 하였음.
---------------------------------------------------------------------------------------------------------------------------------
제로보드의 경우 향후 <head> 편집창을 별도로 제공할것 같은데..그땐 좀더 쉬운 방법으로 처리가 되겠죠.
팝업창 처리 방법은 여러가지가 있으나..그중 한가지 이고..이것보다 더 좋은 방법은 댓글로 의견 주세요.
참고로 오늘 하루만 보기가 이 소스는 제대로 안먹히고 있는것 같음..^^










Script

Script 


