Беляев Игорь 0 Report post Posted April 27, 2017 Суть вопроса такова: Нужно чтобы на сайте по натяжным потолкам был простейший калькулятор. Нашел на просторах интернета скрипт калькулятора на js чуть допилил под себя, теперь вопрос как его грамотно вставить в muse Вот сам скрипт: function check_digits(if_no_points) { var key = event.keyCode; if (!(key >= 48 && key <= 57) && key != 8 && key != 46) { event.returnValue = false; } } function calculate() { var price = 0; var room_length = document.calc.room_length.value; var room_width = document.calc.room_width.value; var tubes_quantity = document.calc.tubes_quantity.value; var lightpoints_quantity = document.calc.lightpoints_quantity.value; var angles_quantity = document.calc.angles_quantity.value; var lustra_quantity = document.calc.lustra_quantity.value; if (room_length > 0 && room_width > 0) { document.getElementById('roof_size').innerText = room_length * room_width; document.getElementById('roof_perimeter').innerText = 2 * room_length + 2 * room_width; if (angles_quantity >= 4) price = room_length * room_width * 350 + (2 * room_length + 2 * room_width) * 50 + tubes_quantity * 300 + lightpoints_quantity * 450 + (angles_quantity - 4) * 100 + lustra_quantity * 800; } else document.getElementById('roof_size').innerText = "0"; document.getElementById('price').innerText = price + "руб."; return true; } Share this post Link to post
0 Павел Хомерики 3360 Report post Posted April 27, 2017 2 часа назад, Беляев Игорь сказал: Нашел на просторах интернета скрипт калькулятора на js чуть допилил под себя, теперь вопрос как его грамотно вставить в muse Скрипт перед закрывающим тегом body, html прямо на страницу, сss в head. Share this post Link to post
Суть вопроса такова:
Нужно чтобы на сайте по натяжным потолкам был простейший калькулятор.
Нашел на просторах интернета скрипт калькулятора на js чуть допилил под себя, теперь вопрос как его грамотно вставить в muse
Вот сам скрипт:
function check_digits(if_no_points) { var key = event.keyCode; if (!(key >= 48 && key <= 57) && key != 8 && key != 46) { event.returnValue = false; } } function calculate() { var price = 0; var room_length = document.calc.room_length.value; var room_width = document.calc.room_width.value; var tubes_quantity = document.calc.tubes_quantity.value; var lightpoints_quantity = document.calc.lightpoints_quantity.value; var angles_quantity = document.calc.angles_quantity.value; var lustra_quantity = document.calc.lustra_quantity.value; if (room_length > 0 && room_width > 0) { document.getElementById('roof_size').innerText = room_length * room_width; document.getElementById('roof_perimeter').innerText = 2 * room_length + 2 * room_width; if (angles_quantity >= 4) price = room_length * room_width * 350 + (2 * room_length + 2 * room_width) * 50 + tubes_quantity * 300 + lightpoints_quantity * 450 + (angles_quantity - 4) * 100 + lustra_quantity * 800; } else document.getElementById('roof_size').innerText = "0"; document.getElementById('price').innerText = price + "руб."; return true; }
Share this post
Link to post