title: Changing div css color via onclick and by using getElementByName
body: <p>this is what I've done so far using CSS,Javascript and HTML..  if you click the red circle, it will change to yellow 
  which is working but, I just want to add some functions, if the user clicks anywhere outside of the div, then the div will go back to its original color. </p>
  
  <p>How can I do it?</p>
  
  <p>here's my code:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;div id="circle" name="color" onclick="changeColor()"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>CSS:</p>
  
  <pre><code>#circle{
      height: 100px;
      width: 100px;
      border-radius: 100px;
      background: #F00;
      border: 2px solid ; 
  }
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>function changeColor() {
      document.getElementsByName('color')[0].style.background="#FF0"; 
  }
  </code></pre>
  
  <p>Thanks.. :)</p>