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>
You don’t have a
mountnor alamvariables in yourcalculatefunction, I think is a copy/paste error, look:Should be:
Also be aware that if you make an assignment without using the
varstatement, those variables will become global…