It
's the creation of the cookie string that takes some effort
Creating the text content of the cookie
Cookies
-------------------------------------------------------
document.cookie
=
"cookiename=cookievalue"
x
=
document.cookie
// x becomes "name1=value; name2=value2" there is a space after the ;
Xarray
=
document.cookie.split (
"; "
)
// note the space
Xarray[0]
=
"name1=value1"
Xarray[1]
=
"name2=value2'
no spaces
/
commas
/
semicolons allowed
in
cookie
document.cookie
=
"state"
+
escape
(
"New York"
)
// to handle spaces in cookie (*cannot have spaces otherwise)
X
=
unescape
(document.cookie)
// reverses the escape action
document.cookie
=
"name=value"
;expires
=
GMT_string
" // persistent cookies