views:

39

answers:

1

Hello, I am setting a cookie, but I don't want it to just work for one directory. How do I make it to where it's read throughout my whole site? I'm pretty new at JavaScript, thanks guys!

<script>
function setCookie(val) {

   var d = new Date();
   d.setDate(d.getDate() + 300);
   document.cookie = "roster_count" + "=" + escape(val) + "; expires=" + d.toGMTString();

   delete d;
}
</script>
+1  A: 

The the path /:

document.cookie = "roster_count" + "=" + escape(val) + "; expires=" + d.toGMTString() + "; path=/";
Gumbo
Thank you Gumbo!
Reden