View

부모페이지 <head>안에

<!-- 오늘~하루 팝업삽입 -->
<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 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( "pop1" ) != "done" ){
 noticeWindow = window.open('/inc/popup.asp','pop1','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=450,top=0,left=0');
 noticeWindow.opener = self;
}
//-->
//두번째 새창띄우기 시작
if ( getCookie( "pop2" ) != "done" ){
 noticeWindow = window.open('/inc/popup2.asp','pop2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=330,top=0,left=400');
 noticeWindow.opener = self;
}
//-->
</script>
-------------------------------------------------------------------------
pop1페이지에서 <head>사이에
<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].pop1.checked )
                setCookie( "pop1", "done" , 1);
        self.close();
}
// -->
</script>
-------------------------------------------------------------------------
pop2페이지에서 <head>사이에
<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].pop2.checked )
                setCookie( "pop2", "done" , 1);
        self.close();
}
// -->
</script>
-------------------------------------------------------------------------
내용부분 닫기에

<form><input type="checkbox" name="pop1" onclick="closeWin()"></form>
-------------------------------------------------------------------------
이미지로 쿠키값넣은 닫기버튼은 안되는 것 같음. 알아볼 것.
위의 소스는 체크박스가 꼭 필요함 (체크박스가 쿠키값을 인식하는 역할을 하는 듯)

Share Link
reply
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30