truefusion, on 04 December 2010 - 05:35 PM, said:
What's the protocol being used when viewing the page? file:// or http://? I wouldn't expect the cookie to be set for file://
Ok, so I tried running it off my host and I'm still having problems. The cookie is being made and the value of the cookie is being stored properly but its not being read correctly on page load. I tried some more things though. On the cookie guide that was linked in the first reply, when readCookie was used there was no semicolon. It just says
var x = readCookie('ppkcookie1')
So I tried no semicolon and that didn't work. Seemed dumb to me but figured I'd give it a shot. I then tried changing the way index gets its integer.
//var index=0; original initiation.
var index;
function checkCookie()
{
if (readCookie('page')!=NULL)
{
index = readCookie('page')
document.getElementById('my_image_container').setAttribute('src', images[index]);
document.getElementById('my_text_container').innerHTML = story[index];
}
else
{
//added index=0 here
index=0;
createCookie('page',index,365);
}
}
window.onload=checkCookie;
When I did that my next button would no longer work. So I can assume that something is going terribly wrong when reading the cookie.