title: javascript enable disabled checkbox on click and select only one at a time
body: <p>I am dynamically generating checkboxes with id like chkBox100 etc and with onClick function.</p>
  
  <p>What I want to do is </p>
  
  <ol>
  <li>Only select one checkbox at a time.</li>
  <li>If a previous checkbox is checked and another checkbox is check, deslect the previous one.</li>
  <li>If I click on the selected checkbox, it should deslect it.</li>
  </ol>
  
  <p>I want to do it in standard javascript without jquery or any other library.</p>
  
  <p>Please help your help will be appreciated. Here's my code so far.</p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt; New Document &lt;/title&gt;  
  
      &lt;script type="text/javascript"&gt;
  
        function toggle(chkBox)
        {
          if (chkBox.checked)
          {
            chkBox.checked = false;
          }
          else
          {
            chkBox.checked = true;
          }
  
          // only select one at a time.
        }
      &lt;/script&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;form id="myForm" name="myForm"&gt;
        &lt;input type="checkbox" id="chkBox100"  onClick="toggle(this);"&gt;
        &lt;input type="checkbox" id="chkBox121"  onClick="toggle(this);"&gt;
        &lt;input type="checkbox" id="chkBox1180" onClick="toggle(this);"&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>