/[webpac]/trunk2/out/js/cookies.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk2/out/js/cookies.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 514 - (show annotations)
Mon Oct 18 12:21:07 2004 UTC (19 years, 6 months ago) by dpavlin
File MIME type: application/javascript
File size: 874 byte(s)
JavaScript support for cookies

1 function get_cookie(name) {
2 var start = document.cookie.indexOf(name+"=");
3 var len = start+name.length+1;
4 if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
5 if (start == -1) return null;
6 var end = document.cookie.indexOf(";",len);
7 if (end == -1) end = document.cookie.length;
8 return unescape(document.cookie.substring(len,end));
9 }
10
11 function set_cookie(name,value,expires,path,domain,secure) {
12 document.cookie = name + "=" +escape(value) +
13 ( (expires) ? ";expires=" + expires.toGMTString() : "") +
14 ( (path) ? ";path=" + path : "") +
15 ( (domain) ? ";domain=" + domain : "") +
16 ( (secure) ? ";secure" : "");
17 }
18
19 function delete_cookie(name,path,domain) {
20 if (get_cookie(name)) document.cookie = name + "=" +
21 ( (path) ? ";path=" + path : "") +
22 ( (domain) ? ";domain=" + domain : "") +
23 ";expires=Thu, 01-Jan-70 00:00:01 GMT";
24 }

  ViewVC Help
Powered by ViewVC 1.1.26