Вынужден опять обращаться к вам, переименование функции не помогло, 2 калькулятора опять отказываются работать на одной странице, не могу понять в чем дело
<b> ширина:</b> <input id="shir" type="text" value="5" /> <b>M<sup>2</sup></b>
<b> длина:</b> <input id="dlin" type="text" value="5" /> <b>M<sup>2</sup></b>
<form id="form" name="form">
<div class="calc-bgarea">
<b> Выберите тип:</b>
<input type="radio" id="color1" name="cena" value="12000" checked />Стандарт
<input type="radio" id="color2" name="cena" value="13000" />Цвет<br/>
<input type="radio" id="color3" name="cena" value="14000" />Стекляшки
<input type="radio" id="color4" name="cena" value="15000" />Плитка
<b> толщина</b>
<input type="radio" id="tolsh1" name="toshina" value="0" checked />30 мм
<input type="radio" id="tolsh2" name="toshina" value="1000" />40 мм<br/>
<input type="radio" id="tolsh3" name="toshina" value="2000" />60 мм
<input type="radio" id="tolsh4" name="toshina" value="5000" />80 мм
<b> Бортик </b>
<input type="radio" id="bort1" name="borti" value="0" checked />Без бортика
<input type="radio" id="bort2" name="borti" value="1000" /> С прямоугольным бортиком<br/>
<br/>
<input type="checkbox" value="2000" id="dost" />
<label for="dost">Требуется доставка?</label>
<br/>
<input type="checkbox" value="5000" id="ust" />
<label for="ust">Требуется установка?</label>
<br/>
</div>
<div class="calc-bg2">
Итого
</div>
<div class="calc-bgtotal">
Итого: <span id="result">0</span> руб.<br>
</div>
</form>
<script>
document.body.onload = function() {
function calc1() {
var d = document, price = tolshi = dostavka = ustanovka = bortik = 0;
shir1 = +d.getElementById("shir").value,
dlin1 = +d.getElementById("dlin").value,
sq = (shir1 * dlin1 / 1000000),
color1 = d.getElementById("color1"),
color2 = d.getElementById("color2"),
color3 = d.getElementById("color3"),
color4 = d.getElementById("color4"),
tolsh1 = d.getElementById("tolsh1"),
tolsh2 = d.getElementById("tolsh2"),
tolsh3 = d.getElementById("tolsh3"),
tolsh4 = d.getElementById("tolsh4"),
bort1 = d.getElementById("bort1"),
bort2 = d.getElementById("bort2"),
dost = d.getElementById("dost"),
ust = d.getElementById("ust"),
result = d.getElementById("result"),
kol = d.getElementById("kol");
if (color1.checked) price = +color1.value;
if (color2.checked) price = +color2.value;
if (color3.checked) price = +color3.value;
if (color4.checked) price = +color4.value;
if (tolsh1.checked) tolshi = +tolsh1.value;
if (tolsh2.checked) tolshi = +tolsh2.value;
if (tolsh3.checked) tolshi = +tolsh3.value;
if (tolsh4.checked) tolshi = +tolsh4.value;
if (bort1.checked) bortik = +bort1.value;
if (bort2.checked) bortik = +bort2.value;
if (dost.checked) dostavka = +dost.value;
if (ust.checked) ustanovka = +ust.value
result.innerHTML = Math.round(sq * (price + tolshi) + dostavka + ustanovka + bortik* dlin1/1000);
};
document.form.onchange = calc1;
calc1();
}
</script>
<b> ширина:</b> <input id="shir" type="text" value="5" /> <b>M<sup>2</sup></b>
<b> длина:</b> <input id="dlin" type="text" value="5" /> <b>M<sup>2</sup></b>
<b> ширина1:</b> <input id="shir01" type="text" value="5" /> <b>M<sup>2</sup></b>
<b> длина1:</b> <input id="dlin01" type="text" value="5" /> <b>M<sup>2</sup></b>
<form id="form" name="form">
<div class="calc-bgarea">
<b> Выберите тип:</b>
<input type="radio" id="color1" name="cena" value="12000" checked />Стандарт
<input type="radio" id="color2" name="cena" value="13000" />Цвет<br/>
<input type="radio" id="color3" name="cena" value="14000" />Стекляшки
<input type="radio" id="color4" name="cena" value="15000" />Плитка
<b> толщина</b>
<input type="radio" id="tolsh1" name="toshina" value="0" checked />30 мм
<input type="radio" id="tolsh2" name="toshina" value="1000" />40 мм<br/>
<input type="radio" id="tolsh3" name="toshina" value="2000" />60 мм
<input type="radio" id="tolsh4" name="toshina" value="5000" />80 мм
<b> Бортик </b>
<input type="radio" id="bort1" name="borti" value="0" checked />Без бортика
<input type="radio" id="bort2" name="borti" value="1000" /> С прямоугольным бортиком<br/>
<br/>
<input type="checkbox" value="2000" id="dost" />
<label for="dost">Требуется доставка?</label>
<br/>
<input type="checkbox" value="5000" id="ust" />
<label for="ust">Требуется установка?</label>
<br/>
</div>
<div class="calc-bg2">
Итого
</div>
<div class="calc-bgtotal">
Итого: <span id="result">0</span> руб.<br>
</div>
</form>
<script>
document.body.onload = function() {
function calc2() {
var d = document, price = tolshi = dostavka = ustanovka = bortik = 0;
shir1 = +d.getElementById("shir").value,
dlin1 = +d.getElementById("dlin").value,
shir2 = +d.getElementById("shir01").value,
dlin2 = +d.getElementById("dlin01").value,
sq = ((shir1 * dlin1 / 1000000) + (shir2 * dlin2 / 1000000) - (shir1 * shir2 / 1000000)),
color1 = d.getElementById("color1"),
color2 = d.getElementById("color2"),
color3 = d.getElementById("color3"),
color4 = d.getElementById("color4"),
tolsh1 = d.getElementById("tolsh1"),
tolsh2 = d.getElementById("tolsh2"),
tolsh3 = d.getElementById("tolsh3"),
tolsh4 = d.getElementById("tolsh4"),
bort1 = d.getElementById("bort1"),
bort2 = d.getElementById("bort2"),
dost = d.getElementById("dost"),
ust = d.getElementById("ust"),
result = d.getElementById("result"),
kol = d.getElementById("kol");
if (color1.checked) price = +color1.value;
if (color2.checked) price = +color2.value;
if (color3.checked) price = +color3.value;
if (color4.checked) price = +color4.value;
if (tolsh1.checked) tolshi = +tolsh1.value;
if (tolsh2.checked) tolshi = +tolsh2.value;
if (tolsh3.checked) tolshi = +tolsh3.value;
if (tolsh4.checked) tolshi = +tolsh4.value;
if (bort1.checked) bortik = +bort1.value;
if (bort2.checked) bortik = +bort2.value;
if (dost.checked) dostavka = +dost.value;
if (ust.checked) ustanovka = +ust.value
result.innerHTML = Math.round(sq * (price + tolshi) + dostavka + ustanovka + bortik* dlin1/1000);
};
document.form.onchange = calc2;
calc2();
}
</script>