same cookie to be used all over website

P

piet

Hi

I have taken this script from internet:

function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 *
1000));

document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays
== null) ? "" : "; expires=" + ExpireDate.toGMTString() ) ;
}
It writtes a value to a cookie.

Now I need to be able to use this value across my whole website,
including different directories. eg. website/
and website/rec/
How would I do this?

I also have this function to delete the cookie: does it need changing
as well? function delCookie (NameOfCookie) {
if (getCookie(NameOfCookie)) {document.cookie = NameOfCookie + "="
+"; expires=Thu, 01-Jan-70 00:00:01 GMT" ; }
}

txs
Piet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top