title: How to calculate value from different function
body: <p>I'm trying to calculate several values from an option selected.</p>
  
  <pre><code>&lt;label&gt;Processor&lt;/label&gt; &lt;/br&gt;
          &lt;form action="3.php" method="POST"&gt; 
              &lt;select id="proSelect" name="processor" onchange="proSelectValue()"&gt;
                  &lt;option value="0"&gt;Pilih Processor&lt;/option&gt;
                  &lt;?php echo $pro_option;?&gt;
              &lt;/select&gt;
              &lt;input type="text" id="proPrice" readonly placeholder="0"&gt;&lt;/br&gt;&lt;/br&gt;
  
          &lt;label&gt;Motherboard&lt;/label&gt;&lt;/br&gt;
              &lt;select id="moboSelect" name="motherboard" onchange="moboSelectValue()"&gt;
                  &lt;option value="0"&gt;Pilih Motherboard&lt;/option&gt;
                  &lt;?php echo $mobo_option;?&gt;
              &lt;/select&gt;
              &lt;input type="text" id="moboPrice" readonly placeholder="0"&gt;&lt;/br&gt;&lt;/br&gt;
  </code></pre>
  
  <p>There the options is show, and if the option selected then the value of the options is shown in the <code>id="proPrice"</code> and <code>id="moboPrice"</code>. 
  And the javascript for the value on the <code>id="proPrice"</code> is</p>
  
  <pre><code>function proSelectValue() {
          var selObj = document.getElementById("proSelect");
          var selValue = selObj.options[selObj.selectedIndex].value;
  
          document.getElementById("proPrice").value = selValue;
      }
  
  function moboSelectValue() {
          var selObj = document.getElementById("moboSelect");
          var selValue = selObj.options[selObj.selectedIndex].value;
  
          document.getElementById("moboPrice").value = selValue;
      }
  </code></pre>
  
  <p>Now I wanted to calculate all of the value and show in this input</p>
  
  <pre><code>&lt;label&gt;Total Harga&lt;/label&gt;
      &lt;input type="text" id="totalPrice" readonly&gt;
  </code></pre>
  
  <p>How do i calculate the all of the value?</p>