title: How do I determine if a checkbox is checked?
body: <p>For some reason, my form does not want to get the value of a checkbox... I am not sure if it is my coding or not, but when I try and <code>alert()</code> the value, I get <code>undefined</code> as a result. What do I have wrong?</p>
  
  <pre><code>&lt;head&gt;
    &lt;script&gt;
      var lfckv = document.getElementById("lifecheck").checked
      function exefunction(){
        alert(lfckv);
      }
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;label&gt;&lt;input id="lifecheck" type="checkbox" &gt;Lives&lt;/label&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried changing it to this</p>
  
  <pre><code>function exefunction() {
      alert(document.getElementById("lifecheck").checked);
  }
  </code></pre>
  
  <p>But now it doesn't even want to <code>execute</code>. What's going wrong?</p>