title: Change color of button with javascript
body: <p>I'm having trouble changing the color of a button with a simple function, the color doesn't change at all.</p>
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
  
       &lt;script language=&quot;JavaScript&quot;&gt;
  
          function changeColor(){
               document.getElementsByTagName('button').style.backgroundColor=&quot;green&quot;;
          }
  
       &lt;/script&gt;
  
      &lt;/head&gt;
  
      &lt;body &gt;
  
          &lt;form action=&quot;/action_page.php&quot; method=&quot;get&quot; name=&quot;form1&quot;&gt;
              &lt;input type=&quot;text&quot; id=&quot;campoDeFlores&quot;&gt;
              &lt;button type=&quot;button&quot; onclick=&quot;changeColor()&quot; name=&quot;1&quot;&gt;1&lt;/button&gt;
              &lt;button type=&quot;button&quot;  name=&quot;2&quot;&gt;2&lt;/button&gt;
              &lt;button type=&quot;button&quot;  name=&quot;3&quot;&gt;3&lt;/button&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Why does it not work?</p>