Checkbox to act like radio button, check first four or last four checkboxes but not both- javascript?
<p>I am having a problem in javaScript. 
I want to check either any of the first 4 checkboxes or any of the last four checkboxes to true. 
here in my code if i check any one of the first four or all first four of the checkbox, last four checkboxes are disabled. 
now after checking any one or the first four last four are unclickable.
i want them to be clickable and the first four checkboxes to be unchecked.
please correct my code</p>

<p>Here is my code and thanks in advance</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;FooBar&lt;/title&gt;
&lt;script language="javascript"&gt;
function checkOnly(checked)
{
  if(document.myForm.elements[0].checked == true || document.myForm.elements[1].checked == true || document.myForm.elements[2].checked == true || document.myForm.elements[3].checked == true)
  {
      document.myForm.elements[4].checked = 0;
      document.myForm.elements[5].checked = 0;
      document.myForm.elements[6].checked = 0;
      document.myForm.elements[7].checked = 0;
  }  


}        
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form name="myForm"&gt;
&lt;?php for($i=1;$i&lt;=8;$i++){ ?&gt;
&lt;input type="checkbox" name="cb" id="cb" value="1" onClick="checkOnly(this)"&gt;
&lt;?php } ?&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
