I have created a function that writes a cookie with certain variables in it:
function writeData(name, allpicsSize, numberofPictures)
{
parent.document.cookie=”name=” + escape(name) + “; allpicsSize=” + escape(allpicsSize) + “; numberofPictures=” + escape(numberofPictures)
location.href=”files/pictures_character_overview.html”
}
as you can see, after the cookie is written, another page is loaded. On that page there’s another function to read the cookie and assign the values to the right variables:
var name=readCookie(“name”)
var allpicsSize=readCookie(“allpicsSize”)
var numberofPictures=readCookie(“numberofPictures”)
function readCookie(required)
{
cookie=unescape(parent.document.cookie)
list=cookie.split(‘;’)
data=””
for (counter=0; counter<list.length; counter++)
{
parts=list[counter].split(‘=’)
if (parts[0].substring(0,1)==’ ‘)
{
parts[0]=parts[0].substring(1,parts[0].length)
}
if (parts[0]==required)
{
data=parts[1]
break
}
}
return data
}
But when the page is loaded I find that only the first variable (name) has been given the right value. The other two have no value whatsoever.
Can anyone tell me what I did wrong?