Posted By

LuckyShot on 12/04/09


Tagged

jquery BIBLE


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

LuckyShot
BrianCoyDesign


jQuery BIBLE


 / Published in: PHP
 

A bit of everything

  1. // Library linking
  2. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
  3.  
  4. // Cookies
  5. /**
  6.   createCookie("name","john",30); // name,value,days
  7.   document.write = readCookie("name");
  8.   eraseCookie("name");
  9. **/
  10. function createCookie(c,e,d){if(d){var b=new Date();b.setTime(b.getTime()+(d*24*60*60*1000));var a="; expires="+b.toGMTString()}else var a="";document.cookie=c+"="+e+a+"; path=/"}function readCookie(c){var e=document.cookie.split(';');var d=c+"=";for(var b=0;b<e.length;b++){var a=e[b];while(a.charAt(0)==' ')a=a.substring(1,a.length);if(a.indexOf(d)==0)return a.substring(d.length,a.length)}return null}function eraseCookie(c){createCookie(c,"",-1)}

Report this snippet  

You need to login to post a comment.