$(function() {
var price = document.getElementById('answer'),
ems_price = 2200;
avia_price = 2500;
sal_price = 2700;
parohod_price = 1800;
price.innerHTML = ems_price;
function question() {
var method = $('.find').val();
switch(method) {
case 'ems':
var weight = +$('#weight').val();
var sum = ems_price;
if(weight >= 0.5 && weight <= 1){ // было weight => 0.5
for (var i= 50; i< weight*100; i++) { //было var i = 5 и weight * 10
sum += 20; // было sum += 200
};
price.innerHTML = sum;
};
if(weight >= 1.25 && weight <= 2){ //Добавил
for (var i = 125; i< weight * 100; i++) {
sum += 24;
};
price.innerHTML = sum;
}; //Конец добавленного
break;
case 'avia':
price.innerHTML = avia_price;
break;
case 'sal':
price.innerHTML = sal_price;
break;
case 'parohod':
price.innerHTML = parohod_price;
break;
}
}
$('#weight').on("change", question);
$('.find').on("change", question);
});