title: html & javascript: multiple checkboxes run same function for multiple textboxes
body: <p>I want <code>chkbox1</code> to call a javascript function for <code>txtbox1</code>, <code>chkbox2</code> to call the same function but for <code>txtbox2</code>, and so on.</p>
  
  <p>To take it a step further, I want all checkboxes checked in their default state and I want the functions to run when unchecked.</p>
  
  <p>How can I achieve this?</p>
  
  <p>I only know simple way for one checkbox:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function OnChangeCheckbox(checkbox) {
    if (checkbox.checked) {
      alert("The check box is checked.");
    } else {
      alert("The check box is not checked.");
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="checkbox" value="yes" checked onclick="OnChangeCheckbox (this)" /&gt;
  &lt;label for="checkbox"&gt;uncheck box&lt;/label&gt;</code></pre>
  </div>
  </div>
  </p>