title: Change Variables Depending on Selected Set of Checkbox
body: <p>I have a set of checkbox which has different values depending on the combination of selected boxes, but the code I made didn't work, I was thinking maybe the location of my &amp;&amp; sign is not in proper position but I don't know where exactly I can put it to run the code.</p>
  
  <p>Here is the html code:</p>
  
  <pre><code>&lt;form role="form" id="checkbox" name="checkbox" onclick="changevalue()"&gt;
      &lt;input type="checkbox" id="f1"&gt;Full Front
      &lt;input type="checkbox" id="b1"&gt;Full Back
      &lt;input type="checkbox" id="f2"&gt;Pocket
  &lt;/form&gt;
  
  &lt;input type="number" id="checkboxResult"&gt;
  </code></pre>
  
  <p>And here is the script:</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
      function changevalue(form){
          var chkboxvalue = 0;
              if (document.getElementById('f1').checked) &amp;&amp;
              if (document.getElementById('b1').checked) {
                  chkboxvalue = 2.2;
              };
  
              if (document.getElementById('f2').checked) &amp;&amp;
              if (document.getElementById('b1').checked) {
                  chkboxvalue = 1.7;
              };
  
          document.getElementById('checkboxResult').value = chkboxvalue;
      }
  &lt;/script&gt;
  </code></pre>