title: Set cookie and get cookie with JavaScript
body: <p>I'm trying to set a cookie depending on which CSS file I choose in my HTML. I have a form with a list of options, and different CSS files as values. When I choose a file, it should be saved to a cookie for about a week. The next time you open your HTML file, it should be the previous file you've chosen.</p>
  
  <p>JavaScript code:</p>
  
  <pre><code>function cssLayout() {
      document.getElementById("css").href = this.value;
  }
  
  
  function setCookie(){
      var date = new Date("Februari 10, 2013");
      var dateString = date.toGMTString();
      var cookieString = "Css=document.getElementById("css").href" + dateString;
      document.cookie = cookieString;
  }
  
  function getCookie(){
      alert(document.cookie);
  }
  </code></pre>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;form&gt;
      Select your css layout:&lt;br&gt;
      &lt;select id="myList"&gt;
          &lt;option value="style-1.css"&gt;CSS1&lt;/option&gt;
          &lt;option value="style-2.css"&gt;CSS2&lt;/option&gt;  
          &lt;option value="style-3.css"&gt;CSS3&lt;/option&gt;
          &lt;option value="style-4.css"&gt;CSS4&lt;/option&gt;
      &lt;/select&gt;
  &lt;/form&gt;
  </code></pre>