title: Javascript: selecting values from a dropdown
body: <p>I had a standard calculation javascript and now I need to add-in multiple calculations based on a user-selected value - can't seem to get it to work....!  Any chance someone could have a look and tell me where I'm going wrong???</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  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 &lt;= 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 &lt;= 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 &lt;= 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)
      }
    }
  }
  &lt;/script&gt;
  </code></pre>