스크립트 단에서 쿠키제어
function setCookie(cookieName, value, exdays){
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var cookieValue = escape(value) + ((exdays==null) ? "" : "; expires=" + exdate.toGMTString());
document.cookie = cookieName + "=" + cookieValue;
}
function deleteCookie(cookieName){
var expireDate = new Date();
expireDate.setDate(expireDate.getDate() - 1);
document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString();
}
function getCookie(cookieName) {
cookieName = cookieName + '=';
var cookieData = document.cookie;
var start = cookieData.indexOf(cookieName);
var cookieValue = '';
if(start != -1){
start += cookieName.length;
var end = cookieData.indexOf(';', start);
if(end == -1)end = cookieData.length;
cookieValue = cookieData.substring(start, end);
}
return unescape(cookieValue);
'잡지식' 카테고리의 다른 글
[ django ] 괜히 쓸모있었던 블로그 포스팅들 (0) | 2021.01.18 |
---|---|
JAVA JDBC/DBCP/JNDI (0) | 2017.06.06 |
java string 문자열에서 숫자인지 문자인지 분류 (0) | 2016.05.25 |