After a lot of confusing research, I've given up trying to figure out how to write the code for a project I'm working on and I am hoping someone can help me out.
I need to create an HTML price quote block for a client's website. The formula needs to be able to do this:
(Income * 0.01) + ((Property Value + Investments - Debt)*0.005)
So the variables are Income, Property Value, Investments, and Debt. The output needs to be in dollars ($) and should be a minimum of 150. In other words, if someone type in values that would equal less than 150, it should display 150.
My attempt is below.
What's going wrong?
function calculatePrice(myform){
//Get selected data
var elt = document.getElementById(“income");
var elt = document.getElementById(“property");
var elt = document.getElementById(“investments");
var elt = document.getElementById("debt");
//convert data to integers
income = parseInt(income);
property = parseInt(property);
investments = parseInt(investments);
investments = parseInt(debt);
//calculate total value
var result=Math.max(income * 0.01 + (property + investments - debt)*0.005, 150);
//print value to PicExtPrice
document.getElementById("PicExtPrice").value=total;
}
The new calculated price: