title: How to change the document background color when select list option for that color is selected
body: <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 change_color() {
    var getSelect = document.getElementsByName("colorPick");
    var selection = getSelect.options[getSelect.selectedIndex].value;
    for (i = 0; i &lt; getSelect.options.length; i++) {
      document.body.style.backgroundColor = selection;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select name="colorPick" onchange="change_color();"&gt;
    &lt;option value="0"&gt;Background Color&lt;/option&gt;
    &lt;option value="1"&gt;Blue&lt;/option&gt;
    &lt;option value="2"&gt;Cyan&lt;/option&gt;
    &lt;option value="3"&gt;White&lt;/option&gt;
  &lt;/select&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>/<em>Something is wrong.  I have tried many different things but nothing seems to work when I select a color.</em>/</p>