Это типа калькулятора приведу весь скрипт, в зависимости от выбранных чекбоксов меняется сумма.
function getOrderStampSum() {
var sum = 0;
var sum2 = 0;
var sum3 = 0;
var sum4 = 0;
var sum5 = 0;
if (document.getElementById('100').checked) {sum += 297;}
else if (document.getElementById('200').checked) {sum += 421;}
else if (document.getElementById('300').checked) {sum += 545;}
else if (document.getElementById('400').checked) {sum += 710;}
else if (document.getElementById('500').checked) {sum += 834;}
else if (document.getElementById('600').checked) {sum += 958;}
else if (document.getElementById('700').checked) {sum += 1123;}
else if (document.getElementById('800').checked) {sum += 1247;}
else if (document.getElementById('900').checked) {sum += 1371;}
else if (document.getElementById('1000').checked) {sum += 1537;}
if (document.getElementById('design1').checked) {sum5 += 0;}
else if (document.getElementById('design2').checked) {sum5 += 100;}
else if (document.getElementById('design3').checked) {sum5 += 300;}
else if (document.getElementById('design4').checked) {sum5 += 500;}
if (document.getElementById('sides1').checked) {sum3 += 0;}
else if (document.getElementById('sides2').checked) {
if (document.getElementById('100').checked) {sum3 += 120;}
else if (document.getElementById('200').checked) {sum3 += 187;}
else if (document.getElementById('300').checked) {sum3 += 255;}
else if (document.getElementById('400').checked) {sum3 += 345;}
else if (document.getElementById('500').checked) {sum3 += 413;}
else if (document.getElementById('600').checked) {sum3 += 480;}
else if (document.getElementById('700').checked) {sum3 += 570;}
else if (document.getElementById('800').checked) {sum3 += 638;}
else if (document.getElementById('900').checked) {sum3 += 705;}
else if (document.getElementById('1000').checked) {sum3 += 795;}
}
if (document.getElementById('standart').checked) {sum2 += 0;}
else if (document.getElementById('splen').checked) {
if (document.getElementById('100').checked) {sum2 += 103;}
if (document.getElementById('200').checked) {sum2 += 165;}
if (document.getElementById('300').checked) {sum2 += 226;}
if (document.getElementById('400').checked) {sum2 += 309;}
if (document.getElementById('500').checked) {sum2 += 371;}
if (document.getElementById('600').checked) {sum2 += 433;}
if (document.getElementById('700').checked) {sum2 += 516;}
if (document.getElementById('800').checked) {sum2 += 578;}
if (document.getElementById('900').checked) {sum2 += 639;}
if (document.getElementById('1000').checked) {sum2 += 721;}
}
else if (document.getElementById('designer').checked) {
if (document.getElementById('100').checked) {sum2 += 0;}
if (document.getElementById('200').checked) {sum2 += 0;}
if (document.getElementById('300').checked) {sum2 += 0;}
if (document.getElementById('400').checked) {sum2 += 0;}
if (document.getElementById('500').checked) {sum2 += 0;}
if (document.getElementById('600').checked) {sum2 += 0;}
if (document.getElementById('700').checked) {sum2 += 0;}
if (document.getElementById('800').checked) {sum2 += 0;}
if (document.getElementById('900').checked) {sum2 += 0;}
if (document.getElementById('1000').checked) {sum2 += 0;}
}
else if (document.getElementById('cover').checked) {
if (document.getElementById('100').checked) {sum2 += 218;}
if (document.getElementById('200').checked) {sum2 += 349;}
if (document.getElementById('300').checked) {sum2 += 481;}
if (document.getElementById('400').checked) {sum2 += 656;}
if (document.getElementById('500').checked) {sum2 += 787;}
if (document.getElementById('600').checked) {sum2 += 918;}
if (document.getElementById('700').checked) {sum2 += 1093;}
if (document.getElementById('800').checked) {sum2 += 1224;}
if (document.getElementById('900').checked) {sum2 += 1356;}
if (document.getElementById('1000').checked) {sum2 += 1530;}
}
if (document.getElementById('krug1').checked) {sum4 += 0;}
else if (document.getElementById('krug2').checked) {
if (document.getElementById('100').checked) {sum4 += 50;}
else if (document.getElementById('200').checked) {sum4 += 100;}
else if (document.getElementById('300').checked) {sum4 += 150;}
else if (document.getElementById('400').checked) {sum4 += 200;}
else if (document.getElementById('500').checked) {sum4 += 250;}
}
document.getElementById('order_stamp_sum').innerHTML = sum+sum2+sum3+sum4+sum5;
}
То есть получается, что 30 разных материалов типа 'cover', 'designer' и т.д. Но все в количествах 100, 200, 300 и т.д. Писать вот такую конструкцию 30-40 раз вроде не правильно и грамоздко
else if (document.getElementById('splen').checked) {
if (document.getElementById('100').checked) {sum2 += 103;}
if (document.getElementById('200').checked) {sum2 += 165;}
if (document.getElementById('300').checked) {sum2 += 226;}
if (document.getElementById('400').checked) {sum2 += 309;}
if (document.getElementById('500').checked) {sum2 += 371;}
if (document.getElementById('600').checked) {sum2 += 433;}
if (document.getElementById('700').checked) {sum2 += 516;}
if (document.getElementById('800').checked) {sum2 += 578;}
if (document.getElementById('900').checked) {sum2 += 639;}
if (document.getElementById('1000').checked) {sum2 += 721;}