here is a little more information:
I know I need two cookies one to keep track of the last page that the user has visited and one to flag whether or not this is the first time they've seen the page this session. Im just having syntax problems. Can someone help me fix my code?
this is the script on the main page:
Code:
function setCookies()
{
var cdRom = document.location="cdrom1.html"
document.cookie = "cdRom="+cdRom+";expires=" + expireDate.toGMTString()
document.location="cdrom1.html"
}
this is the script on the first page of one of my sections:
Code:
expireDate = new Date()
expireDate.setYear(expireDate.getYear()+1)
function getCookie(Name)
{
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0)
{
offset = document.cookie.indexOf(search)
if (offset != -1)
{
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
if(getcookie("track")!="")
{
document.location=cdrom1.html
}
else
{
var stringToSplit=cdRom
var aryStrings=stringToSplit.split("=")
document.location=aryStrings
}
alert(document.cookie)
function setCookies()
{
var cdRom = document.location="cdrom2.html"
document.cookie="track"
document.cookie = "cdRom="+cdRom+";expires=" + expireDate.toGMTString()
document.location="cdrom2.html"
}
I'm new to javascript so be gentle
Bookmarks