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.

23 lines
615 B

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