05/01: JavaScript > クッキー Cookies
Category: Z. etc
Posted by: hajime osako
Crispy JavaScript Cookies: JavaScript Cookie Functions - Doc JavaScript
function setCookie(name, value, expires, path, domain, secure) {
if(!expires)
{
expires = new Date();
var yy = expires.getYear();
if (yy < 2000) yy += 1900;
expires.setYear(yy+1);
}
if(value.length <= 4000)
{
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}
}