Google Answers Logo
View Question
 
Q: Javascript: cookie setting and deleting ( No Answer,   0 Comments )
Question  
Subject: Javascript: cookie setting and deleting
Category: Computers > Programming
Asked by: davidawallis-ga
List Price: $5.00
Posted: 02 Nov 2006 00:57 PST
Expires: 02 Dec 2006 00:57 PST
Question ID: 779335
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);
	}
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy