title: Using checkbox value inside conditional statements in JavaScript
body: <p>I'm doing a questionnaire/survey using HTML. I need to get the value of the checkbox that is being checked. The questions on the next page(L2) will be based on the questions that is only checked on the checkbox when i click "submit".</p>
  
  <p>I have a problem in getting and storing the value of the checkbox and using it later for an IF else-If else statement. Read a lot of online materials but I can't see any light from this. Any help will do... here is the code of the plain checkbox.</p>
  
  <pre><code>&lt;html&gt; 
      &lt;head&gt; 
      &lt;/head&gt;
      &lt;body&gt;
          &lt;script&gt;
              var vg = document.getElementId("VideoGame").checked;
              var te = document.getElementId("Text").checked;
              var an = document.getElementId("Animals").checked;
              var sp = document.getElementId("Sports").checked;
              var lo = document.getElementId("Logo").checked;
          &lt;/script&gt;
          &lt;form action="L2.html"&gt;   
              Check the box if applicable: &lt;br&gt;
              &lt;input type="checkbox" name="Q1" id="VideoGame"&gt; The image is a Video Game. 
              &lt;br&gt;
              &lt;input type="checkbox" name="Q1" id="Text"&gt; The image contains text. &lt;br&gt;
              &lt;input type="checkbox" name="Q1" id="Animals"&gt; The image is about animals. 
              &lt;br&gt;
              &lt;input type="checkbox" name="Q1" id="Sports"&gt; The image is about sports. 
              &lt;br&gt;
              &lt;input type="checkbox" name="Q1" id="Logo"&gt; The image contains a logo. &lt;br&gt;
              &lt;input type="submit" value="NEXT"&gt; 
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>