Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] ughh HELP WITH COOKIES PLEASE!!!!
- From: javascript@xxxxxxxxxx (Podlesny, Michael)
- Subject: [Javascript] ughh HELP WITH COOKIES PLEASE!!!!
- Date: Mon, 25 Nov 2002 12:52:36 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C294AB.707BB870
Content-Type: text/plain;
charset="iso-8859-1"
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));
}
------_=_NextPart_001_01C294AB.707BB870
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2722.900" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=522445017-25112002><FONT face=Arial size=2>ughh HELP WITH
COOKIES PLEASE!!!!</FONT></SPAN></DIV>
<DIV><SPAN class=522445017-25112002><FONT face=Arial size=2>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?</FONT></SPAN></DIV>
<DIV><SPAN class=522445017-25112002><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=522445017-25112002><FONT face=Arial color=#0000ff size=2>here
is the code</DIV>
<DIV><BR></DIV></FONT></SPAN>
<DIV><FONT face=Arial color=#0000ff size=2>function set_cookie(name, value,
expires, path, domain, secure) {<BR> var curCookie = name + "=" +
escape(value) +<BR> ((expires) ? "; expires=" +
expires.toGMTString() : "") +<BR> ((path) ? ";
path=" +<SPAN class=522445017-25112002> path </SPAN>: "")
+<BR> ((domain) ? "; domain=" + domain : "")
+<BR> ((secure) ? "; secure" : "");<BR>
document.cookie = curCookie;<BR>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2>// name - name of the
desired cookie<BR>// * return string containing value of specified cookie or
null if cookie does not exist<BR>function get_cookie(name) {<BR> var dc =
document.cookie;<BR> var prefix = name + "=";<BR> var begin =
dc.indexOf("; " + prefix);<BR> if (begin == -1) {<BR>
begin = dc.indexOf(prefix);<BR> if (begin != 0) return
null;<BR> } else<BR> begin += 2;<BR> var end =
document.cookie.indexOf(";", begin);<BR> if (end ==
-1)<BR> end = dc.length;<BR> return
unescape(dc.substring(begin + prefix.length, end));<BR>}<BR><SPAN
class=522445017-25112002></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=522445017-25112002> </SPAN></FONT></FONT></FONT></DIV></BODY></HTML>
------_=_NextPart_001_01C294AB.707BB870--
- Follow-Ups:
- [Javascript] ughh HELP WITH COOKIES PLEASE!!!!
- From: Terry
- [Javascript] ughh HELP WITH COOKIES PLEASE!!!!
- Prev by Date: [Javascript] FastScript3D
- Next by Date: [Javascript] ughh HELP WITH COOKIES PLEASE!!!!
- Previous by thread: [Javascript] FastScript3D
- Next by thread: [Javascript] ughh HELP WITH COOKIES PLEASE!!!!
- Index(es):