title: Cookie expiration date
body: <p>I am not a programmer. I am trying to use a cookie script that remembers the last drop down menu selection.</p>
  
  <p>I found a script that works but it does only a session cookie. How do I add an expiration date to the cookie in this script?</p>
  
  <pre><code>&lt;head&gt;
    &lt;script&gt;        
      function SETcookie() {
        document.cookie = "Selected=" + document.getElementById('myList').selectedIndex;
      }
  
      function GETcookie() {
        if (document.cookie) {
          eval(document.cookie);
          document.getElementById('myList').selectedIndex = Selected;
        }
      }    
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body onLoad="GETcookie()"&gt;
    &lt;select id="myList" onChange="SETcookie()"&gt;
      &lt;option value="1"&gt;Option 1&lt;/option&gt;
      &lt;option value="2"&gt;Option 2&lt;/option&gt;
      &lt;option value="3"&gt;Option 3&lt;/option&gt;
      &lt;option value="4"&gt;Option 4&lt;/option&gt;
    &lt;/select&gt;
  &lt;/body&gt;
  </code></pre>