title: Javascript onClick wont execute unless clicked twice
body: <p>having another problem with my javascript for my table. Basically, if you look at the link I post, I have three cells with checkmarks and coloured red. When I click on the cell, the checkmark is removed and the cell changes colour. I want to make my reset button return the table to its initial state. However, this takes two clicks. You can test this out on the link here: <a href="http://cs1.ucc.ie/~od1/project_css/" rel="nofollow">http://cs1.ucc.ie/~od1/project_css/</a></p>
  
  <p>Viewing the source there would be best but here is my javascript code that won't allow it to work:</p>
  
  <pre><code>        function resetColour(objName){
              var arr = document.getElementsByName(objName);
              var arrLen = arr.length;
  
              for(var i = 0; i &lt; arrLen; i++){
                  if(arr[i].checked){
                      arr[i].parentNode.style.backgroundColor = "#F26C4F";
                  }
                  else{
                      arr[i].parentNode.style.backgroundColor = "#FAF4E3";
                  }
              } 
          }
  </code></pre>
  
  <p>Is there any way I can make the form both reset and change colour with ONE click?</p>