我有一个标准计算 javascript,现在我需要根据用户选择的值添加多个计算 - 似乎无法让它工作......!有没有机会有人可以看看并告诉我我哪里出错了???
<script type="text/javascript">
function calculate() {
var noPeople = document.ContactForm.noPeople.value;
var ddl = document.getElementById("menuType");
var selectedValue = ddl.options[ddl.selectedIndex].value;
var noPeople_excess = (noPeople-6);
if (selectedValue == 3) {
var basic = 337;
var marchCost = (50*noPeople);
if (marchCost <= basic) {
document.ContactForm.marchCost.value = 337;
document.ContactForm.marchCostVin.value = basic +(noPeople*25)
} else {
document.ContactForm.marchCost.value = basic +(noPeople_excess*34);
document.ContactForm.marchCostVin.value = basic +(noPeople_excess*34)+(noPeople*25)
}
} else (selectedValue == 4) {
var basic = 368;
var marchCost = (55*noPeople);
if (marchCost <= basic) {
document.ContactForm.marchCost.value = 368;
document.ContactForm.marchCostVin.value = basic +(noPeople*25)
} else {
document.ContactForm.marchCost.value = basic +(noPeople_excess*44);
document.ContactForm.marchCostVin.value = basic +(noPeople_excess*44)+(noPeople*25)
}
} else (selectedValue == 5) {
var basic = 419;
var marchCost = (60*noPeople);
if (marchCost <= basic) {
document.ContactForm.marchCost.value = 419;
document.ContactForm.marchCostVin.value = basic +(noPeople*25)
} else {
document.ContactForm.marchCost.value = basic +(noPeople_excess*54);
document.ContactForm.marchCostVin.value = basic +(noPeople_excess*54)+(noPeople*25)
}
}
}
</script>