생성
function setCookie( cookieName, cookieValue, expireDate )
{
var today = new Date();
today.setDate( today.getDate() + parseInt( expireDate ) );
document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; expires=" + today.toGMTString() + ";"
}
setCookie('이름','값',시간);
사용 불러오기
function getCookie( cookieName ){
var search = cookieName + "=";
var cookie = document.cookie;
// 현재 쿠키가 존재할 경우
if( cookie.length > 0 ){
// 해당 쿠키명이 존재하는지 검색한 후 존재하면 위치를 리턴.
startIndex = cookie.indexOf( cookieName );
// 만약 존재한다면
if( startIndex != -1 ){
// 값을 얻어내기 위해 시작 인덱스 조절
startIndex += cookieName.length;
// 값을 얻어내기 위해 종료 인덱스 추출
endIndex = cookie.indexOf( ";", startIndex );
// 만약 종료 인덱스를 못찾게 되면 쿠키 전체길이로 설정
if( endIndex == -1) endIndex = cookie.length;
// 쿠키값을 추출하여 리턴
return unescape( cookie.substring( startIndex + 1, endIndex ) );
} else{ // 쿠키 내에 해당 쿠키가 존재하지 않을 경우
return false;
}
} else { // 쿠키 자체가 없을 경우
return false;
}
}
getCookie('이름);
삭제
function deleteCookie( cookieName )
{
var expireDate = new Date();
//어제 날짜를 쿠키 소멸 날짜로 설정한다.
expireDate.setDate( expireDate.getDate() - 1 );
document.cookie = cookieName + "= ; expires=" + expireDate.toGMTString() + "; path=/";
}
deleteCookie('이름');
게시판 목록
팁게시판
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6077 | 9년 전 | 194 | ||
| 6076 |
PlayPixel
|
9년 전 | 213 | |
| 6075 | 9년 전 | 207 | ||
| 6074 | 9년 전 | 264 | ||
| 6073 |
|
9년 전 | 228 | |
| 6072 |
|
9년 전 | 385 | |
| 6071 | 9년 전 | 306 | ||
| 6070 |
|
9년 전 | 343 | |
| 6069 | 9년 전 | 315 | ||
| 6068 |
|
9년 전 | 259 | |
| 6067 | 9년 전 | 268 | ||
| 6066 |
|
9년 전 | 394 | |
| 6065 |
PASKRAN
|
9년 전 | 278 | |
| 6064 | 9년 전 | 304 | ||
| 6063 |
kiplayer
|
9년 전 | 380 | |
| 6062 |
|
9년 전 | 342 | |
| 6061 | 9년 전 | 279 | ||
| 6060 |
|
9년 전 | 340 | |
| 6059 |
|
9년 전 | 294 | |
| 6058 |
|
9년 전 | 284 | |
| 6057 | 9년 전 | 329 | ||
| 6056 |
|
9년 전 | 260 | |
| 6055 |
|
9년 전 | 322 | |
| 6054 |
|
9년 전 | 298 | |
| 6053 |
snshero
|
9년 전 | 662 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기