윈도우 팝업창 오늘하루열지않기 오류ㅜㅡ
본문
<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( "cookie01" ) != "done", 1){ //cookie01는 쿠키의 이름
noticeWindow = window.open('../k_html/pop2.php','popup01','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=364,height=520,top=200,left=60,margin=0,padding=0');// 팝업창의 경로, 이름, 그외 스크롤바와 크기,위치 설정부분
noticeWindow.opener = self;
}
// -->
</script>
--------------------------------------------------------------------------------------
<script language="JavaScript">
<!--
function setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
todayDate.setHours(0);
todayDate.setMinutes(0);
todayDate.setSeconds(0);
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function close_day() {
//if ( document.forms[0].chkbox.checked ) //'오늘은이창을....'부분의 체크박스와 관련된 값입니다. chkbox는 chkbox의 name값
setCookie( "cookie01", "done" , 1); // 쿠키값 체크
self.close();
}
//3일동안열지않음
function close_3day() {
setCookie( "cookie01", "done" , 3); // 쿠키값 체크
self.close();
}
// 한달동안 열지 않음
function close_month() {
setCookie( "cookie01", "done" , 30); // 쿠키값 체크
self.close();
}
function close_window() {
self.close();
}
// 새창띄우고 링크적용 후 팝업창닫기
function link_blank(url) {
window.open(url);
self.close();
}
// 부모페이지에 링크적용 후 팝업창닫기
function link_opener(url){
opener.window.location.href=url;
self.close();
}
// -->
</script>
<style type="text/css">
#popup_cont { position: relative; width: 340px; height: 490px; margin: 0; padding: 0;}
#popup_cont a { margin: 0; padding: 0; }
#down { position: absolute; bottom: 10px; right: 0; width: 300px; font: normal 13px 'dotum'}
</style>
<form name="popup">
<div id="popup_cont">
<a href="javascript:;" onclick="link_opener('http://test.com');"><img src="../popup/140718-popup.jpg"></a>
<div id="down">
<input type="checkbox" name="chkbox">오늘 하루 페이지를 열지 않습니다.
<a href="javascript:;" onclick="close_window();"> [닫기] </a>
</div>
</div>
</form>
위처럼 하니 팝업창은 잘뜨는데 오늘하루보지않기를 체크를 했는데도 새로고침할때마다 자꾸 뜨네요
코드에 뭐가 문제일까요? ㅜ
알려주셔요ㅜㅜ