Copy
// 쿠키 가져오기
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 "";
}
// 24시간 기준 쿠키 설정하기
// expiredays 후의 클릭한 시간까지 쿠키 설정
function setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
위 팝업용 코드를 가지고 사이드에 광고 배너 같은 것을 볼 수 없도록 응용을 했습니다.
1일(24시간) 동안 보지 않는 것을 12시간으로 수정하려면 뭘 고쳐야 하나요?
답변 부탁드립니다!!
|
답변 2개
채택된 답변
+20 포인트
답변을 작성하려면 로그인이 필요합니다.