title: Why is the first checkbox working but not the second?
body: <p>Why is the first checkbox working but not the second, what am I doing wrong? :S</p>
  
  <p>
       
       </p>
  
  <pre><code> &lt;meta http-equiv="Content-type" value="text/html; charset=UTF-8" /&gt;
  
   &lt;script type="text/javascript" language="javascript"&gt;
   function SetAllCheckBoxes(FormName, AreaID)
   {
  
   if(!document.forms[FormName])
   return;
   var objCheckBoxes = document.getElementById(AreaID).getElementsByTagName('input');
   if(!objCheckBoxes)
   return;
   var countCheckBoxes = objCheckBoxes.length;
   if(!countCheckBoxes)
   objCheckBoxes.checked = CheckValue;
   else
   for(var i = 0; i &lt; countCheckBoxes; i++)
   objCheckBoxes[i].checked = false;
   }
   &lt;/script&gt;
  
  
   &lt;/head&gt;
  
   &lt;div id="items"&gt;
    &lt;input name="checkall" type="checkbox" onclick="SetAllCheckBoxes('SelectedItems','items');"&gt;&lt;br&gt;
   &lt;form name="SelectedItems" action="" method="post"&gt;
   &lt;b&gt;Select/Unselect All&lt;/b&gt;&lt;br&gt;
  
  
   &lt;input id="idGSSmodules" type="checkbox" name="GSS" &gt;
   &lt;label for="idmodules"&gt;GSS&lt;/label&gt;&lt;br&gt;
   &lt;input type="checkbox" name="GTS" id="idGSSmodules"&gt;
   &lt;label for="idmodules"&gt;GSS&lt;/label&gt;
   &lt;br&gt;
  
   &lt;/div&gt;
  
   &lt;div id="itemss"&gt;
    &lt;input name="checkall" type="checkbox" onclick="SetAllCheckBoxes('SelectedItemss','itemss');"&gt;&lt;br&gt;
   &lt;form name="SelectedItemss" action="" method="post"&gt;
   &lt;b&gt;Select/Unselect All&lt;/b&gt;&lt;br&gt;
  
  
   &lt;input id="idGSSmodules" type="checkbox" name="GSS" &gt;
   &lt;label for="idmodules"&gt;GSS&lt;/label&gt;&lt;br&gt;
   &lt;input type="checkbox" name="GTS" id="idGSSmodules"&gt;
   &lt;label for="idmodules"&gt;GSS&lt;/label&gt;
   &lt;br&gt;
  
   &lt;/div&gt;
  
   &lt;/form&gt;
  
   &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p><strong>EDIT*<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em></strong></p>
  
  <p>How do I call the method on the form  SetAllCheckBoxes(FormName, AreaID); In other words I would like to call the function whithout using a checkbox?</p>
  
  <p>Tried this, but then I cant change the value of the checkboxes</p>
  
  <pre><code> function unCheckBoxes(FormName, AreaID) {
       if(!document.forms[FormName])
       return;
       var objCheckBoxes = document.getElementById(AreaID).getElementsByTagName('input');
       if(!objCheckBoxes)
       return;
       var countCheckBoxes = objCheckBoxes.length;
  
       for(var i = 0; i &lt; countCheckBoxes; i++)
       objCheckBoxes[i].checked = false;
   }
   function checkCheckBoxes(FormName, AreaID){
       if(!document.forms[FormName])
       return;
       var objCheckBoxes = document.getElementById(AreaID).getElementsByTagName('input');
       if(!objCheckBoxes)
       return;
       var countCheckBoxes = objCheckBoxes.length;
  
  
       for(var i = 0; i &lt; countCheckBoxes; i++)
       objCheckBoxes[i].checked = true;
   }
  checkCheckBoxes('locForm','locCheckboxes');
  </code></pre>