[Javascript] ughh HELP WITH COOKIES PLEASE!!!!
Terry
bader at tcbader.com
Mon Nov 25 11:58:49 CST 2002
Please show us how you are calling the function...
~ Terry
757 581-5981
AIM/Yahoo: lv2bounce
----- Original Message -----
From: Podlesny, Michael
To: 'javascript at LaTech.edu'
Sent: Monday, November 25, 2002 12:52 PM
Subject: [Javascript] ughh HELP WITH COOKIES PLEASE!!!!
ughh HELP WITH COOKIES PLEASE!!!!
The code below only saves my cookie for the page in which it is set. Does anyone have any ideas as to why my cookie is deleted when I access the another page on my sitter?
here is the code
function set_cookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}
// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function get_cookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20021125/bad5131f/attachment.htm>
More information about the Javascript
mailing list