A new, object-oriented, better vesion of μForum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
639 B

  1. function create_cookie(name, value, days)
  2. {
  3. if (days)
  4. {
  5. var date = new Date();
  6. date.setTime(date.getTime()+(days*24*3600*1000));
  7. var expires ="; expires="+date.toGMTString();
  8. }
  9. else
  10. var expires = "";
  11. document.cookie += name+"="+value+expires+"; path=/";
  12. }
  13. function read_cookie(name)
  14. {
  15. var nameEQ = name + "=";
  16. var ca = document.cookie.split(';');
  17. for (var i=0; i< ca.length; i++)
  18. {
  19. var c = ca[i];
  20. while (c.charAt(0) == ' ') c = c.substring(1, c.length);
  21. if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
  22. }
  23. return null;
  24. }
  25. function erase_cookie(name)
  26. {
  27. create_cookie(name, "", -1);
  28. }