View Full Version : Cookie


jackson
12-18-2004, 12:14 AM
Hi,

I am using the following coding for accessing the cookie.
dokie = document.cookie
dokie=unescape(dokie);
start = dokie.indexOf("name=")+"name=".length;
end = dokie.indexOf(";", start);
if(end==-1)end = dokie.length
document.write(dokie.substring(start, end))

After entering the username, the username is stored in the cookie and it is accessed in another page as "Welcome Jackson"

But if i close the ie window again i go to that same url then i am getting as t=2 instead of jackson(username).
Please Help me.

Jack

relaxzoolander
01-18-2005, 03:21 AM
to create a cookie that lasts beyond the current browser session...
you must create a 'persistent' cookie.
include the "expires" value pair to do this:

document.cookie = "mysiteiscool=yes;expires=Mon, 14 Oct 2007 09:25:29 UTC"

.