title: Change Text Box Background Color Using JavaScript
body: <p>I have tried a few solutions I have seen and none of them are actually changing the background color of my text box.  These are the 2 things I have tried<br>
  1) <code>state.style.backgroundColor = "#FF0000"</code><br><br>
  2) <code>state.style.backgroundColor = "red";</code><br><br></p>
  
  <p>And this is the function I am trying to use</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function VerifyStateWasEntered() {
      var state;
      state = document.getElementByID("txtstate").value; 
      if (state == '') {
          alert("Error Please Enter A Valid State");
          state.style.backgroundColor = "red";
          return false;
      }}      
  </code></pre>
  
  <p><br><br></p>
  
  <p>And this is the HTML I am using to create the text box</p>
  
  <pre><code>&lt;asp:TextBox id="txtstate" runat="server" /&gt;
  </code></pre>