Calculator for calculating price per feet amounts So I have a customers site I am remaking into an mvc3 app and they have an existing JavaScript pricing calculator.  Is this safe and efficient?  I am no JavaScript guy, but it looks pretty solid to me.

  &lt;script type="text/javascript"&gt;

    window.onload = function () {

        //Carpet
        var ppf = .25; //price per square foot, edit this to suit
        //tile
        var ppfTile = .50; //price per square foot, edit this to suit
        var ppfVCTWood = .60; //price per square foot, edit this to suit
        var ppfTravertine = .60; //price per square foot, edit this to suit

        df = document.carpet;
        df[0].focus();
        df[2].onclick = function () {
            df[0].focus();
        };
        df[0].onkeyup = function () {
            if (isNaN(df[0].value)) {
                alert('numbers only please');
                df.reset();
                df[0].focus();
                return;
            }
            df[1].value = '$' + util.formatCurrency(df[0].value * ppf);
            df[2].value = '$' + util.formatCurrency(df[0].value * ppfTile);
            df[3].value = '$' + util.formatCurrency(df[0].value * ppfVCTWood);
            df[4].value = '$' + util.formatCurrency(df[0].value * ppfTravertine);
        };
    };
    var util = {
        formatCurrency: function (num) {
            num = isNaN(num) || num === '' || num === null ? 0.00 : num;
            return parseFloat(num).toFixed(2);
        }
    };
&lt;/script&gt;


And here is the form.

&lt;form name="carpet" action="#"&gt;
&lt;div id="container"&gt;
    &lt;h2 style="font-size: 12pt;"&gt;
        Cost Estimate&lt;/h2&gt;
    &lt;label&gt;
        &lt;input class="inp" type="text" /&gt;
        : Enter Square Footage&lt;/label&gt;
    &lt;br /&gt;
    &lt;label&gt;
        &lt;input class="inp" type="text" value="$0" readonly="readonly" /&gt;
        : Estimated Cost For Carpet&lt;/label&gt;
    &lt;br /&gt;
    &lt;label&gt;
    &lt;input class="inp" type="text" value="$0" readonly="readonly" /&gt;
    : Estimated Cost For Tile &lt;/label&gt;
    &lt;br /&gt;
    &lt;label&gt;
    &lt;input class="inp" type="text" value="$0" readonly="readonly" /&gt;
    : Estimated Cost For VCT and Wood &lt;/label&gt;
    &lt;br /&gt;
    &lt;label&gt;
    &lt;input class="inp" type="text" value="$0" readonly="readonly" /&gt;
    : Estimated Cost For Travertine Tile &lt;/label&gt;
    &lt;br /&gt;
    &lt;input type="reset" /&gt;
&lt;/div&gt;
&lt;/form&gt;


I am worried this is old and outdated. Could I do this more effectively with C# in the app?
About the only thing that I don't like in it is that you have to edit the code each time a price changes. I'd prefer that to come from a dynamic source, especially if you are going to use it in more than one spot.