[thelist] JS: Cookie Madness
Hassan Schroeder
hassan at webtuitive.com
Tue Feb 3 14:42:03 CST 2004
Tom Dell'Aringa wrote:
> function SetCookie (cookieName, cookieValue, expireDate)
> {
> if (!expireDate) expireDate = new Date();
> document.cookie = cookieName + "=" + cookieValue + ";
> expires=" + expireDate.toGMTString();
> Problem: the ; preceding expires is causing the cookie to not be
> written
Uh, `expireDate = new Date()` is *right now* and by the time you
set the cookie it's already in the past, eh?
Presumably you want it to expire at (now + some_interval) :-)
HTH,
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
More information about the thelist
mailing list