title: getting or setting cookies with javascript
body: <p>My question is if I can set a cookie using javascript (and read it)</p>
  
  <p>My first impression is that the code beneath doesn't work
  If I look in my vista cookie folder, I can not see the name of the cookie</p>
  
  <pre><code>function zetCookie(naam,waarde,dagen) {     // setCookie(name,value,days)
      if (dagen) {
          var date = new Date();
          date.setTime(date.getTime()+(days*24*60*60*1000));
          var verloopdatum = "; expires="+date.toGMTString(); // expiry_date
      }
      else var verloopdatum = "";
      document.cookie = naam+"="+waarde+verloopdatum+"; path=/";
  }    
  
  function readCookie(name) {
      var nameEQ = name + "=";
      var ca = document.cookie.split(';');
      for(var i=0;i &lt; ca.length;i++) {
          var c = ca[i];
          while (c.charAt(0)==' ') c = c.substring(1,c.length);
          if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
      }
      return null;
  }
  </code></pre>