title: select onchange local storage not working in firefox
body: <p>I found similar Question but answers were with Jquery or not working in this particular case.
  i have the following HTML code</p>
  
  <pre><code>&lt;html&gt;
  &lt;body onload="load()"&gt;
  &lt;div&gt;
      &lt;select id="colorlist" onchange="saveSelect()"&gt;
          &lt;option value="white"&gt;White&lt;/option&gt;
          &lt;option value="#E0C2FF"&gt;#E0C2FF&lt;/option&gt;
          &lt;option value="orange"&gt;Orange&lt;/option&gt;
          &lt;option value="purple"&gt;Purple&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and the following javascript code which works in Chrome but not in Firefox (I didn't test in IE yet).</p>
  
  <pre><code>function saveSelect () {
      localStorage.bgColor = document.getElementById("colorlist").value;
      document.body.style.backgroundColor = localStorage.bgColor; 
  }
  function load() {
      if (localStorage.bgColor.length == 0) {
          localStorage.bgColor = "white";
      }
      else {
          document.body.style.backgroundColor = localStorage.bgColor;
          document.getElementById("colorlist").value = localStorage.bgColor;
      }
  }
  </code></pre>
  
  <p>If you know a good solution for Firefox or possibly for all Browsers in HTML, CSS or the best would be in Javascript (please no Library like Jquery), i would be thankful.</p>
  
  <p>Sugestions by Freez </p>
  
  <p><a href="http://jsfiddle.net/4a60k1vm/" rel="nofollow">http://jsfiddle.net/4a60k1vm/</a></p>
  
  <p>sometimes it works sometimes not.</p>