Cookie Path Example

<SCRIPT>

var expdate = new Date();

// 24 hrs from now
expdate.
setTime(expdate.getTime() + (24 * 60 * 60 * 1000));

// if no path is specified it defaults to the present directory - /coin70/week1
setCookie("TestPath", "TestPath no path assigned", expdate);

// set the path to the Week 2 directory
setCookie("TestPath", "TestPath Week 2", expdate, "/coin70/week2");

// set the path to the root
setCookie("TestPath", "TestPath /", expdate, "/");

// set the path to the Week 7 directory
setCookie("Week7", "Week 7 Cookie Path Test", expdate, "/coin70/week7");

// do a "Cookie Dump" for this particular directory - /coin70/week1
document.
write(unescape(document.cookie) + "<P>");

// get the cookie value for TestPath
document.
write("TestPath = " + getCookie("TestPath") + "<BR>");

// get the cookie value for Week7
document.
write("Week7 = " + getCookie("Week7") + "<BR>");

</SCRIPT>