자신이 원하는 기간동안만 팝업을 띄우면서,
그기간안에 체크하면 하루에 한번씩만 팝업띄우는 소스입니다.


<head>와 </head>사이에 아래 소스를 자신에 맞게 수정하여 넣으세요.

<SCRIPT LANGUAGE="JavaScript">
<!--
//팝업창띄우기
function popup(goPageURL,goPageName,goPageWidth,goPageHeight)
{
window.open(goPageURL,goPageName,'width='+goPageWidth+',height='+goPageHeight+',menubar=no, scrollbars=no, resizable=no');
}

//하루동안 팝업뜨지않게 하기위한...
function notice_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 "";
}

// 팝업을 띄울 날짜를 설정 하세요

var goLiveDate = "20030401"; // 시작일
var expireDate = "20030431";  // 종료일 - 종료일이 되면 팝업이 뜨지 않습니다.

var expireYear = expireDate.substring(0,4)
var expireMonth = expireDate.slice(4,-2)
var expireDay = expireDate.slice(6)
var liveYear = goLiveDate.substring(0,4)
var liveMonth = goLiveDate.slice(4,-2)
var liveDay = goLiveDate.slice(6)
var nowDate = new Date();
var day = nowDate.getUTCDate();
var month = nowDate.getUTCMonth();
var month1 = month + 1;
  if (month1 < 10)
  {
  month1 = "0" + month1;
  }
  if (day < 10)
  {
  day = "0" + day;
  }
var year = nowDate.getYear();
var GMTdate = year + "" + month1 + "" + day

if ((GMTdate < expireDate) && (GMTdate >= goLiveDate))
//지정된 기간일경우
{
if ( notice_getCookie( "Notice" ) != "done" )
//오늘그만띄우기를 체크를 하지않았을경우
{
popup('xxxxx.html','notice','206','206');
//지정한 날짜동안만 팝업띄우기
}
}

//-->
</SCRIPT>
Posted by 알 수 없는 사용자
,