본문 바로가기

프로그램?!

팝업공지창 다시 안뜨게 하는 소스[날짜지정가능]

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;
}





function closeWin(){
  if(document.forms[0].Notice.checked)
  setCookie( "Notice", "done" , 1); //1이란 숫자는 1일간 안보임을 뜻합니다. 날짜는 자신에 맞게 수정하세요
  //self.close();
}


<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="history.onclick=closeWin()">닫기</a>
     </form>
   </td>
  </tr>
</table>