title: Auto reload a page using JS, with a checkbox to enable/disable the script
body: <p>HTML</p>
  
  <pre><code>&lt;body onload="JavaScript:timedRefresh(10000);"&gt;
      &lt;input type="checkbox" checked="checked" name="autoRefreshCheckboxes" &gt;Auto Refresh&lt;/input&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>  function timedRefresh(timeoutPeriod) {
          if ($("input[name=autoRefreshCheckboxes]").is(":checked")) {
              setTimeout("location.reload(true);", timeoutPeriod);
          }
      }
  </code></pre>
  
  <p>How can I make the checkbox work? 
  <br>
  <br>
  It seems that when the <code>&lt;body&gt;</code> loads, it takes the state of the checkbox, and ignores the state of the checkbox when the script is run.
  <br>
  thanks in advance!</p>