I have the code written correctly to write the cookies, now I have a separate file that needs to READ the cookies and print out the data stored in them. This is a small school assignment.

I am not sure how the data that is being set in the setCookie.html file is being passed to the readCookie.html for it to read it and print it to the browser window. Any help on how I should do this?

This is what I have so far: 1 of 2 ways, neither of which works, and one gives me an error because of a undefined variable which makes sense but I am just going off the book. Which happens to be very very very vague and has not too much to do with what my instructor wants from us....

Anyway,

var yourTeam;
for(var count = 0; count < 3; count++)
{
yourTeam = cookieArray[count];
if(yourTeam.substring(0, yourTeam.indexOf("=")) == "team")
{
document.writeln("Your team is: " + yourTeam.substring(yourTeam.indexOf("=")+1, yourTeam.length));
break;
}
}

///////////////////////////////////option 2 which isn't giving me any output.....

if(document.cookie) //does the cookie exist? if yes proceed...
{
var data = decodeURIComppnent(document.cookie);
var arry = data.split("; ");
document.getElementById("email").value = arry[0].substring(data.lastIndexOf("=")+1);
.
.
.
.
.
.
.

}

So, I am suppose to check for an email address and password and store them for seven days them read them, make sure they are there if not alert the user, if so print to screen and delete. Pretty simple, just not printing to screen, so I am stuck on that part. Any help? I really appreciate it! Thanks!
I felt I was being pretty specific. I read "Bill's cookie cutter code" didn't really help on HOW TO READ FROM AN EXTERNAL FILE. Any REAL help out there?
Let me be a little more specific. The point of this class is to know how to write the code and do this ourselves. Not just how to use the cookie cutter methods. I cannot simply use the set/get/etc methods to do this. I have to do it the "hard" way. So, no I cannot use "Bill's cookie cutter method's" for this assignment. Otherwise, I would not have posted the code I am working with. So, I need better help here. Please. Thanks.