[Javascript] ughh HELP WITH COOKIES PLEASE!!!!

Podlesny, Michael MPodlesny at acsisinc.com
Mon Nov 25 11:52:36 CST 2002


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/f8c28e02/attachment.htm>


More information about the Javascript mailing list