title: Changing Background Image with cookie
body: <p>I am looking for help in putting a cookie into this script so the browser remembers the background image selected when the browser is closed or changed page. Any help would be much appreciated!</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function changeTheme()
  {
  
    var e = document.getElementById("themes");
    var theme = e.options[e.selectedIndex].value;
    console.log(theme);
    document.getElementById("shelf").style.backgroundImage = "url("+theme+")";
  
  }  </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body id="shelf"&gt;
  &lt;select id="themes" onChange="changeTheme()" name="ChangeBG"&gt;
    &lt;option value="images/background1.jpg" selected="selected"&gt;Default&lt;/option&gt;
    &lt;option value="images/background2.jpg"&gt;Heart&lt;/option&gt;
    &lt;option value="images/background3.jpg"&gt;Earthly&lt;/option&gt;
    &lt;option value="images/background4.jpg"&gt;Sunflowers&lt;/option&gt;
    &lt;option value="images/background5.jpg"&gt;Mountin&lt;/option&gt;
  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>