title: Javascript change color of text and background to input value
body: <p>I'm going to use javascript to make a function for changing color of background, as well as text simultaneously - based on the value of a text input. I've got the background color to change, but can't manage to get the text working as well.</p>
  
  <pre><code>function changeBackground() {
      // The working function for changing background color.
      document.bgColor = document.getElementById("color").value;
  
      // The code I'd like to use for changing the text simultaneously - however it does not work.
      document.getElementById("coltext").style.color = document.getElementById("color").value;
  }
  </code></pre>
  
  <p>Looking into the code above, the code for the text <code>document.getElementById("coltext").style.color = x</code> works when I input an actual color, and not the "color" value.</p>
  
  <p>This is the html which of I'm referring to (I know it's horribly optimized, but it's a work in progress):</p>
  
  <pre><code>&lt;form id="TheForm" style="margin-left:396px;"&gt;
      &lt;input id="color" type="text" onchange="changeBackground();" /&gt;
      &lt;br/&gt;&lt;input id="submitColor" value="Submit" type="button" onclick="changeBackground();" style="margin-left:48px; margin-top:5px;" /&gt;
  &lt;/form&gt;
  
  &lt;span id="coltext"&gt;This text should have the same color as you put in the text box&lt;/span&gt;
  </code></pre>
  
  <p>Obviously, and unfortunately, I can't use the code this way. But no matter have hard I try, beyond this, I reach a sort of infinite complexity. It should be a sort of easy way to resolve this, right?</p>