title: how to change background color of textarea and textbox - javascript
body: <p>I'm trying to change the background color of the textarea and text box. 
  All this must be done when the user presses the button click, it activates a function that changes the color of the two components at random. 
  The code I've written does not work, could you help me?</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;textarea id="text"&gt;&lt;/textarea&gt;&lt;br/&gt;
  &lt;input type="text" id="c"&gt;&lt;br/&gt;
  &lt;input type="button" onclick="as()" value="clicca"&gt;
  &lt;/body&gt;
  
  &lt;script&gt;
  
  function as()
  {
  
  var t = document.getElementById('text');
  var c = document.getElementById('c');
  
  t.style="color: red; background-color: lightyellow"
  
  }
  
  &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>