javascript code for a savings calculator on an estate agency site
<p>I'm trying to put some Javascript together for an estate agency website which will allow potential sellers to see how much they could be saving compared to a traditional estate agent. i've built some basic code (see below) but I'm still having some problems and would appreciate some help.</p>

<p>Basically I'm trying to see can the code be modified so that it only calculates the final value after the user has entered a property price, traditional charge (either a percentage of sale from the dropdown or manually entered fixed fee or a combination of these two fields) and selected a selling option from the drop down. Then if the values are changed and/or the selling option is changed can it refresh the saving total automatically.</p>

<p>Thanks for any help</p>

<p>Dave</p>

<pre><code>&lt;html&gt;    
&lt;head&gt;
 &lt;script type="text/javascript"&gt;
  function price() {
var price = 0;
var hpri = document.priceCalc.houseprice;
var feep = document.priceCalc.feeper;
var ffee = document.priceCalc.fixedfee;
var sell = document.priceCalc.sellopt;

var price = parseInt(hpri.value) / 10000 * parseInt(feep.value) + parseInt(ffee.value) - parseInt(sell.value);

document.getElementById("prices").innerHTML = '£' + price;
$(window).load(prices);
  }
 &lt;/script&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;form name="priceCalc" action=""&gt;
  &lt;div class="calnames"&gt;ASKING PRICE £&lt;/div&gt;&lt;input name="houseprice" type="text" onchange="price();" value="0"/&gt;
    &lt;div style="margin-top:3px"&gt;&lt;div class="calnames"&gt;NORMAL FEES &lt;/div&gt;&lt;select name="feeper" onchange="price();" class="calfield"&gt;
        &lt;option value="0"&gt;percentage %&lt;/option&gt;    
        &lt;option value="100"&gt;1%&lt;/option&gt;
        &lt;option value="125"&gt;1.25%&lt;/option&gt;
        &lt;option value="150"&gt;1.5%&lt;/option&gt;
        &lt;option value="175"&gt;1.75%&lt;/option&gt;
        &lt;option value="200"&gt;2%&lt;/option&gt;
        &lt;option value="225"&gt;2.25%&lt;/option&gt;
        &lt;option value="250"&gt;2.5%&lt;/option&gt;
        &lt;option value="275"&gt;2.75%&lt;/option&gt;
        &lt;option value="300"&gt;3%&lt;/option&gt;
        &lt;option value="325"&gt;3.25%&lt;/option&gt;
     &lt;/select&gt;&lt;div class="calnames"&gt; OR FEE £&lt;/div&gt;
     &lt;input name="fixedfee" type="text" class="calfieldtwo" onchange="price();"     value="0" size="5" /&gt;&lt;/div&gt;
     &lt;div style="margin-top:3px"&gt;&lt;div class="calnames"&gt;iHOMES OPTION &lt;/div&gt;&lt;select name="sellopt" onchange="price();" class="calfieldthree"&gt;
        &lt;option value="0"&gt;Select an option&lt;/option&gt;
        &lt;option value="395"&gt;£395 one off fee&lt;/option&gt;
        &lt;option value="225"&gt;£75PM (3 months)&lt;/option&gt;
        &lt;option value="450"&gt;£75PM (6 months)&lt;/option&gt;
            &lt;/select&gt;&lt;/div&gt;
       &lt;div class="calsave"&gt;We could be saving you&lt;/div&gt;
       &lt;div id="prices" class="calprice"&gt;LOADS&lt;/div&gt;

&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
