title: Mark unmark javascript?
body: <p>I've got a function to select all checkboxes in a table:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          function checkAll() {
              var tab = document.getElementById("logs");
              var elems = tab.getElementsByTagName("input");
              var len = elems.length;
  
              for (var i = 0; i &lt; len; i++) {
                  if (elems[i].type == "checkbox") {
                      elems[i].checked = true;
                  }
              }
          }
  </code></pre>
  
  <p>But I can't get it to uncheck them all if they are checked.  How could I do that?</p>
  
  <pre><code>&lt;th width='2%'&gt;&lt;a href="#" onclick="checkAll();"&gt;Mark&lt;/a&gt;&lt;/th&gt;";
  </code></pre>
  
  <p>Also in javascript is it possible to rename "Mark" to "Un-Mark" if I execute <code>checkAll()</code>?</p>