title: Using multiple drop downs and functions to change a URL on a button
body: <p>I've written my js code to change the URL on a button based on the drop down selection you choose on the type of filter you want, but now I also need that URL to change based on how many you add to cart. I have gotten either one function or the other to work, but not both simultaneously. </p>
  
  <p>Any suggestions/help is absolutely welcome! I'm new to javascript.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          function update_price() {
              if ( document.getElementById("filter_menu").value == "1" ){
                  //this is the first element in the drop down menu. do nothing
                  document.getElementById("price").innerHTML = "0.00";
                  document.getElementById("total-price").innerHTML = calculateTotalPrice(0.0, 0.0);
              }
  
              if ( document.getElementById("filter_menu").value == "2" ){
                  // HEPAPure functionality in here.
                  // don't need to create a new function if you don't want to
                  document.getElementById("price").innerHTML = "0.00";
                  document.getElementById("total-price").innerHTML = calculateTotalPrice(599.0, 0.0);
                  document.getElementById('myLink').href="http://www.mysite.com/cart.asp?product=unit-name&amp;cartitem=unit-name&amp;cartadd=1";
              }
  
              if ( document.getElementById("filter_menu").value == "3" ){
                  // HEPASilver
                  document.getElementById("price").innerHTML = "10.00";
                  document.getElementById("total-price").innerHTML = calculateTotalPrice(599.0, 10.0);
                  document.getElementById('myLink').href="http://www.mysite.com/cart.asp?product=unit-name-silver&amp;cartitem=unit-name-silver&amp;cartadd=1";
              }
  
              if ( document.getElementById("filter_menu").value == "4" ){
                  // HEPAFreshPlus
                  document.getElementById("price").innerHTML = "20.00";
                  document.getElementById("total-price").innerHTML = calculateTotalPrice(599.0, 20.0);
                  document.getElementById('myLink').href="http://www.mysite.com/cart.asp?product=unit-name-freshplus&amp;cartitem=unit-name-freshplus&amp;cartadd=1";
  
              }
  
              if ( document.getElementById("filter_menu").value == "5" ){
                  // HEPAOdorCell
                  document.getElementById("price").innerHTML = "30.00";
                  document.getElementById("total-price").innerHTML = calculateTotalPrice(599.0, 30.0);
                  document.getElementById('myLink').href="http://www.mysite.com/cart.asp?product=unit-name-odorcell&amp;cartitem=unit-name-odorcell&amp;cartadd=1";
  
              }
          }
  
          function calculateTotalPrice(unitPrice, price){
              var total = unitPrice + price;
              return total;
          }
  
          function update_URL(){
              if ( document.getElementById("quantity_top").value == "cartadd2" ){
                  // HEPAOdorCell
                  document.getElementById('myLink').href="http://www.mysite.com/cart.asp?product=unit-name-odorcell&amp;cartitem=unit-name-odorcell&amp;cartadd=2";
  
              }
          }   
  
      &lt;/script&gt;
  </code></pre>