title: JavaScript Button Style change on click
body: <p>I have put together this piece of JavaScript, but I am struggling with the code as I'm a newbie. What I want to do is when a button is clicked it will change the background color opacity. The code below does this, but now I want the button to be reverted to the normal state when I click it again.</p>
  
  <p>How can I do this? Thanks..</p>
  
  <blockquote>
    <p>Normal state: background="rgba(255,0,0,0.8)"; Pressed state:
    background="rgba(255,0,0,0.6)";</p>
  </blockquote>
  
  <pre><code>function highlight(id) {
  document.getElementById(id).style.background="rgba(255,0,0,0.6)";
  }
  </code></pre>