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!
function changeTheme()
{
  var e = document.getElementById("themes");
  var theme = e.options[e.selectedIndex].value;
  console.log(theme);
  document.getElementById("shelf").style.backgroundImage = "url("+theme+")";
}  <body id="shelf">
<select id="themes" onChange="changeTheme()" name="ChangeBG">
  <option value="images/background1.jpg" selected="selected">Default</option>
  <option value="images/background2.jpg">Heart</option>
  <option value="images/background3.jpg">Earthly</option>
  <option value="images/background4.jpg">Sunflowers</option>
  <option value="images/background5.jpg">Mountin</option>
</select> 
     
     
    