tags:

views:

32

answers:

1

Can anyone help me spot the problem on this PLEASE? I'm eternally grateful for the help this site has been already and appreciate any advice or thoughts. Thank you.

The actual page can be seen here: http://www.procollage.com/pricing/photo-collage-pricing.html

 <script LANGUAGE="JavaScript">
function calculate(PricingForm) {
    height = PricingForm.height.value;
    width = PricingForm.width.value;
    photos = PricingForm.photos.value;
    lgtext = PricingForm.lgtext.value;
    mountlam = PricingForm.mount.value;
    mountlam = PricingForm.lam.value;

    price = GetPrice(PricingForm, height, width, photos, lgtext, mount, lam)
    document.PricingForm.collageEstimate.value = "$" + RoundToPennies(price);
}

function GetPrice(PricingForm, height, width, photos, lgtext, mount, lam) {

        price = height * width;
        price = price / 144;
        pricetwo = price; // for lookup later
        price = price * 15;

        price = (PricingForm.lgtext.checked) ? price + 20 : price;
        price = (PricingForm.mount.checked) ? price + pricetwo * 5 : price;
        price = (PricingForm.lam.checked) ? price + pricetwo * 5 : price;

        return (photos * 4.95) + price;
}

function RoundToPennies(n) {
    pennies = n * 100;
    pennies = Math.round(pennies);
    strPennies = "" + pennies;
    len = strPennies.length;
    return strPennies.substring(0, len - 2) + "." + strPennies.substring(len - 2, len);
}

</script>
+2  A: 

You don't have a mount nor a lam variables in your calculate function, I think is a copy/paste error, look:

function calculate(PricingForm) {
  //...
  mountlam = PricingForm.mount.value; // <--- the same identifier
  mountlam = PricingForm.lam.value;   // <---

  price = GetPrice(PricingForm, height, width, photos, lgtext, mount, lam);
  //..                                                           ^     ^
}

Should be:

//...
mount = PricingForm.mount.value;
lam = PricingForm.lam.value;

price = GetPrice(PricingForm, height, width, photos, lgtext, mount, lam);
//..

Also be aware that if you make an assignment without using the var statement, those variables will become global...

CMS
AWESOME. Thank you. I shoulda caught that one myself. Cheers!
dg