Calculate hidden fields with jquery
<p>I have a form that i'm trying to calculate some monetary value based on 2 dropdowns then show the total amount only the total in a textbox called <code>GrandTotal</code> which is read only.</p>

<p>Page loads and gets pricing data from DB into hidden fields.</p>

<blockquote>
  <p>InitialPrice = 660 (Mandatory)</p>
  
  <p>EQup1Price =  550</p>
  
  <p>EQup2Price =  440</p>
</blockquote>

<p>2 Drop downs (EQup1, EQup2) Values 1-5.</p>

<p>Buy greater than 1 and get one free for EQup1 and EQup2.</p>

<p>The calculation is whats doing my head in.</p>

<pre><code> &lt;p&gt;InitialPrice -: &lt;strong&gt;$660.00&lt;/strong&gt;&lt;/p&gt;
 &lt;form name="Edit" method="post" action="mypageprocess"&gt;
&lt;p&gt;&lt;label for="EQup1"&gt;How many Branches?&lt;/label&gt;&lt;br /&gt;&lt;select name="EQup1" onblur="calc(this.form)" id="EQup1"/&gt;    
        &lt;option value="0"&gt;Please select&lt;/option&gt; 
        &lt;option value="1" &gt;One&lt;/option&gt;
        &lt;option value="2" &gt;Two&lt;/option&gt;
        &lt;option value="3" &gt;Three&lt;/option&gt;
        &lt;option value="4" &gt;Four&lt;/option&gt;
        &lt;option value="5" &gt;Five&lt;/option&gt;
        &lt;/select&gt; &amp;nbsp;&amp;nbsp; x &lt;strong&gt;$550.00&lt;/strong&gt;
&lt;/p&gt; 


&lt;p&gt;&lt;label for="EQup2"&gt;How many Satellits?&lt;/label&gt;&lt;br /&gt;&lt;select name="EQup2" onblur="calc(this.form)" id="EQup2"/&gt;    
        &lt;option value="0"&gt;Please select&lt;/option&gt; 
        &lt;option value="1" &gt;One&lt;/option&gt;
        &lt;option value="2" &gt;Two&lt;/option&gt;
        &lt;option value="3" &gt;Three&lt;/option&gt;
        &lt;option value="4" &gt;Four&lt;/option&gt;
        &lt;option value="5" &gt;Five&lt;/option&gt;
        &lt;/select&gt; &amp;nbsp;&amp;nbsp; x &lt;strong&gt;$440.00 &lt;/strong&gt;
&lt;/p&gt; 


&lt;input type="text" onfocus="this.blur();" name="GrandTotal" size="10" readonly="readonly"/&gt;

        &lt;input type="hidden" name="InitialPrice" value="660" /&gt;
        &lt;input type="hidden" name="EQup1Price" value="550" /&gt;
        &lt;input type="hidden" name="EQup2Price" value="440" /&gt;
     &lt;/form&gt;

        &lt;script&gt;
          function calc(theForm) {
          // console.log("calc(theForm)");


        var myEquip1 = document.Edit.EQup1.value;
        var myEquip2 = document.Edit.EQup2.value;
        Var myFixedPrice = document.Edit.InitialPrice.value;

Var myEquip1Price = document.Edit.EQup1Price.value;
Var myEquip2Price = document.Edit.EQup2Price.value;

    if  (myEquip1 &gt; 1)
{
    var myEquip1Total = (myEquip1*myEquip1Price) - (myEquip1Price)

}
else
 {
    var myEquip1Total = (myEquip1*myEquip1Price) - (myEquip1Price)

}

    if  (myEquip2 &gt; 1)
{
    var myEquip2Total = (myEquip2*myEquip2Price) - (myEquip2Price)

}
else
 {
    var myEquip2Total = (myEquip2*myEquip2Price) - (myEquip2Price)

}

    theForm.GrandTotal.value = (myEquip2Total + myEquip1Total + myFixedPrice)
    }
    &lt;/script&gt;
</code></pre>
