Forum Moderators: open
I have ExpireDate.setTime (ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
then on to the
document.cookie = NameOfCookie + "=" + escape(value) +
((expiredays == null)? "" : "; expires=" + ExpireDate.toGMTString());
}
function delCookie (NameOfCookie) {
if (getCookie(NameOfCookie)) {
document.cookie = NameOfCookie + "=" +
"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
It wasn't explained what 3600 or 1000 is. Or how the date 01 Jan 1970 was arrived at. Could some kind person help me with this.
It's all a mystery until u work out how.
Thanks
antipodes
i'll take it upside down ;):
3600: seconds per hour (60*60)
1000: milliseconds
so the count of expiredays is multiplicated to get a value of days in milliseconds. this is needed.
i do not know, if the first line of code you wrote is right, but you have to define a date var first. here are some lines of code you can use, too:
var ExpireDate= new Date();
var ExpireTime= ExpireDate.getTime() + ( expiredays * 24 * 3600 * 1000);
ExpireDate.setTime(ExpireTime); this code should solve your problem.