title: Getting checkbox values in HTML to a temporary variable Javascript/HTML
body: <p>I have a lot of checkboxes, with the same id="cbna", but when i submit the form , the javascript code should check If atleat one checkbox is checked, if not an alert should pop up. if it is checked the the value stored in site the checkbox should execute along with the details of a text area. I have tried to do the same but in vain.</p>
  
  <pre><code>    &lt;script&gt;
  
   function checkCheckBoxes(form1) 
       {
      if (document.form1.checked==true)
                {
          function OpenWindow(info)
                 {
                     window.open(info);
                 }
                }
  else
      {
   alert ('You didn\'t choose any of the checkboxes!');
   return false;
      }
  }
  &lt;/script&gt;
  
  &lt;form name="form1" id="form1" method="post" action="" &gt;
    &lt;p&gt;
      &lt;input type="checkbox" name="checkbox" onclick="if(this.checked)OpenWindow(this.value)}" value="www.something.com 1" /&gt;
    google&lt;br /&gt;
   &lt;input type="checkbox" name="checkbox" onclick="if(this.checked){OpenWindow(this.value)}" value="www.something.com 2" /&gt;
    apple&lt;br /&gt;
  
   &lt;input type="checkbox" name="checkbox" onclick="if(this.checked){OpenWindow(this.value)}" value="www.something.com 3" /&gt;
    ibm&lt;br /&gt;
  
   &lt;input type="checkbox" name="checkbox" onclick="if(this.checked){OpenWindow(this.value)}" value="www.something.com 4" /&gt;
    nageo&lt;br /&gt;
  
   &lt;textarea cols="100" rows="22" id="descp" &gt;
   hello wats up!
  &lt;/textarea&gt;
   &lt;input onclick="checkCheckBoxes(form1)" value="create forms" type="button"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>