Trying to calculate what a skipass would cost with sales tax based on the following else-if statements but i get the same answer no matter what i select in my form....what am i missing??
function calculateCost() {
var pass = document.getElementById('pass').value;
var taxes = document.getElementById('taxes').value;
if (pass == "morning", taxes == "ca_Resident") {
console.log(20.00 + 20.00 * .06)
} else if (pass == "afternoon", taxes == "ca_Resident") {
console.log(25.00 + 25.00 * .06)
} else if (pass == "evening", taxes == "ca_Resident") {
console.log(15.00 + 15.00 * .06)
} else if (pass == "morning", taxes == "non_Resident") {
console.log(20.00 + 20.00 * .08)
} else if (pass == "afternoon", taxes == "non_Resident") {
console.log(25.00 + 25.00 * .08)
} else {
console.log(15.00 + 15.00 * .08)
}
}
<select id="pass">
<option value="morning" >Morning</option>
<option value="afternoon">Afternoon</option>
<option value="evening">Evening</option>
</select>
<select id="taxes">
<option value="ca_Resident">CA Resident</option>
<option value="non-Resident">Non Resident</option>
</select>
<input type="button" value="calculate" onclick="calculateCost();">
Aucun commentaire:
Enregistrer un commentaire