I have created a script that sets a cookie, and also delets it.
however i am having trouble when its delets the cookie it stills runs
on sub folders, so i have tried using domain setting but still not
functioning.
I have tried deleting b setting the cookie to - hours from this date/time.
Code is:
var cpath = ""; // path for which allowed [Optional]
var cdomain = "http://www.disabilityjobsite.co.uk"; // domain for
which allowed [Optional]
function getexpirydate(nohours){
var expiry;
// Set expiry Date to 1 hour from now
expiry.setTime((now.getTime() nohours*60*60*1000));
return expiry;
}
function getcookie(cookiename) {
var cookiestring=""+document.cookie;
var index1=cookiestring.indexOf(cookiename);
if (index1==-1 || cookiename=="") return "";
var index2=cookiestring.indexOf(';',index1);
if (index2==-1) index2=cookiestring.length;
return unescape(cookiestring.substring(index1+cookiename.length+1,index2));
}
function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + '=' + escape(value) +
((expires) ? '; expires=' + getexpirydate(expires) : '') +
((path) ? '; path=' + cpath : '') +
((domain) ? '; domain=' + cdomain : '') +
((secure) ? '; secure' : '')
document.cookie = curCookie
}
>>and calling function to delete and set are:
if (sz > 0) {
setCookie('fntsize',sz,1);
}else{
setCookie('fntsize',sz,-3000);
} |