title: How to make One button check Uncheck check box when clicked more than once?
body: <p>I want to have one button that check unchecks a check box when clicked more than one time.</p>
  
  <p>I came up with this:</p>
  
  <pre><code> function choseall() {      
          switch (d) {
  
              case 1:
                  document.getElementById('cbconditioning').checked = true
                  document.getElementById('cbradio').checked = true
                  break;
              case 2:
                  document.getElementById('cbconditioning').checked = false
                  document.getElementById('cbradio').checked = false
                  break;
          }
      }
  
  
          &lt;input id="btnchoseall" type="button" value="Chose All" onclick="choseall()" /&gt;&lt;/tr&gt;
          &lt;input id="cbradio" type="checkbox"/&gt;b. TV Radio (TV, Home Theatre, etc.)&lt;/td&gt;
          &lt;input id="cbconditioning" type="checkbox"/&gt;a. Air Conditioning&lt;/td&gt;
  </code></pre>