我正在尝试编写一个函数来使Cookie在15分钟内过期。我写的正确吗?谢谢。
setCookieExpireIn("cookieName", "value", 15);
function setCookieExpireIn(cookieName, value, expireIn) {
var now = new Date();
var minutes = expireIn;
now.setTime(now.getTime() + (minutes * 60 * 1000));
document.cookie = cookieName + "=" + value + "; expires = " + now.toUTCString() + ";";
} //end of function addToCookieAndExpireIn(cookieName, value, expireIn)