我有这个设置cookie的功能,它在所有浏览器上都很好用,但是在ie7中它根本不保存cookie。
任何想法为什么?
(函数的输入是有效的,我检查了三倍)
function SetCookie(cookieName, cookieValue, nDays) {
try {
var today = new Date();
var expire = new Date();
if (nDays == null || nDays == 0) nDays = 1;
expire.setTime(today.getTime() + 3600000 * 24 * nDays);
var newCookie = cookieName + '=' + cookieValue + '; expires=' + expire.toGMTString()+'; path=/';
document.cookie = newCookie;
} catch (e) {
showAlert('SetCookie:' + e.message);
}
}