Link to home
Start Free TrialLog in
Avatar of daneveland
daneveland

asked on

Javascript using pop-up menu value

I have a javascript that is supposed perform math functions, involving a look up based on what a user elects in a pop-up menu. I made an if-else thing that is supposed to look up the pop-up menu's choice and use various values based on that number. The problem is it only looks p the value when I first open the page. Even though the script is run with an "onclick" it never find the value the pop-p menu has selected by the user.

 function calcROI()
 
 {


      var ROI;
      var INVESTMENT;
      var PROFIT;
      var INVEST_TOT;
      var WEEKLY_COM;
      var NUMBER_COM;
      var BOTTOM_COM;
      var WEEKLY_FRA;
      var NUMBER_FRA;
      var ROYALT_FRA;

 
INVESTMENT = document.inputform.investment.value;


if (document.inputform.investment.value = .01)
 {
INVEST_TOT = 70000;
 }

else if (document.inputform.investment.value = .009)
 {
INVEST_TOT = 45000;
 }
else
{
INVEST_TOT = 15000;

}

     

     
WEEKLY_COM = document.inputform.weekly_company.value;
NUMBER_COM = document.inputform.number_company.value;
BOTTOM_COM = (document.inputform.company_bottom_line.value / 100);
WEEKLY_FRA = document.inputform.weekly_franchise.value;
NUMBER_FRA = document.inputform.number_franchise.value;
ROYALT_FRA = (document.inputform.royalty_franchise.value / 100);
     

      ROI_COM = (((((WEEKLY_COM * 52) * BOTTOM_COM) * NUMBER_COM) * INVESTMENT) / INVEST_TOT);
      ROI_FRA = (((((WEEKLY_FRA * 52) * ROYALT_FRA) * NUMBER_FRA) * INVESTMENT) / INVEST_TOT);
      ROI = Math.round((ROI_COM + ROI_FRA)*100);
      PROFIT_COM = ((((WEEKLY_COM * 52) * BOTTOM_COM) * NUMBER_COM) * INVESTMENT);
      PROFIT_FRA = ((((WEEKLY_FRA * 52) * ROYALT_FRA) * NUMBER_FRA) * INVESTMENT);
      PROFIT = Math.round(PROFIT_COM + PROFIT_FRA);

PROFIT_DONE = "$" + addCommas(PROFIT)
ROI_DONE = ROI + "%"      
      document.inputform.profit_increase.value = PROFIT_DONE;
      document.inputform.roi.value = ROI_DONE;
      document.inputform.investment.value = INVESTMENT
      return false

 }
ASKER CERTIFIED SOLUTION
Avatar of dakyd
dakyd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of daneveland
daneveland

ASKER

Here is the button and the pop-up

<p class="roi_questions"><select class="roi_form_field_pop_up" name="investment">
              <option label="Significant" value=".01" selected>
                Significant ($70,000)
              </option>
              <option label="Medium" value=".009">
                Medium ($45,000)
              </option>
              <option label="Small" value=".008">
                Light ($15,000)
              </option>
            </select>Select the investment you would like to make in increasing your sales.</p>
            <p class="roi_form_buttons"><button onclick="return calcROI()">Click to calculate ROI</button></p>
It was the equal sign thing. THANK YOU!!!!!