function calculateCost()
{
var projectorCost=0,price=0,quantity=0,discountPrice=0,totalCost=0;
var modelName=document.getElementById('projectormodel').value;
var quantity=document.getElementById('quantity').value;
var couponCode=document.getElementById('couponcode').value;
var res=document.getElementById('result');
if(modelname=='Mobile Portable Projector')
{
price=30000;
if(couponCode=='EveryCam45P'){
projectorCost=quantity*price;
discountPrice=projectorCost*0.1;
totalCost=projectorCost-discountPrice;
}
else if(couponCode='EveryCam48P'){
projectorCost=quantity*price;
discountPrice=projectorCost*0.15;
totalCost=projectorCost-discountPrice;
}
}
if(modelName=='Lumen DLP Projector'){
price=31000;
if(couponCode='EveryCam45P'){
projectorCost=quantity*price;
discountPrice=projectorCost*0.1;
totalCost=projectorCost-discountPrice;
}
else if(couponCode='EveryCam48P'){
projectorCost=quantity*price;
discountPrice=projectorCost*0.15;
totalCost=projectorCost-discountPrice;
}
}
document.getElementById("res").innerHTML='Your total cost is Rs.'+totalCost;
return false;
}
My HTML and CSS are working fine, but the issue I'm having is with the JavaScript code. When I submit the form, it's not updating the inner HTML of the result ID as expected. I believe my JavaScript code may have some errors. Being a beginner in this language, I would appreciate any guidance on how to correct this.