I'm trying to create this budget but I can not do it! The page is in the CMS joomla and the javascript I am included in the module, so I do not need to include the library because it already is. The idea is this: * The customer types in the quantity of parts he wants. * in a row choose how many colors these shirts will have (each more colors become more expensive) * Then choose the type of shirt (here you do not need to calculate) * Finally the last input would bring me the calculation * The calculation would look like this: Quantity of colors * 25 / quantity of pieces.
Someone help me please?
<script>
function calcular(){
var qtde_pecas = parseInt(document.getElementById('qtde_pecas').value, 10);
var r3 = (document.getElementById('r3').value, 3);
var r35 = (document.getElementById('r35').value, 3.5);
var r4 = (document.getElementById('r4').value, 4);
var r45 = (document.getElementById('r45').value, 4.5);
var r5 = (document.getElementById('r5').value, 5);
var r55 = (document.getElementById('r55').value, 5.5);
var r6 = (document.getElementById('r6').value, 6);
var r65 = (document.getElementById('r65').value, 6.5);
document.getElementById('valor_unit1').value = r3 * 25 / qtde_pecas;
}
</script>
<form class="orcamento" id="orcamento-pecas">
<div class="qtde_pecas">
<label class="title-pecas">Quantidade de Peças</label><input type="number" id="qtde_pecas" name="qtde-pecas" value="" maxlength="2" size="1" min="1" max="1" onkeyup="calcular();">
</div>
<div class="qtde_cores">
<label class="title-cores">Quantidade de Cores</label>
<select id="qtde_cores">
<option value="3" id="r3" onkeyup="calcular();">01</option>
<option value="3,5" id="r35" onkeyup="calcular();">02</option>
<option value="4" id="r4"onkeyup="calcular();" >03</option>
<option value="4,5" id="r45"onkeyup="calcular();">04</option>
<option value="5" id="r5" onkeyup="calcular();">05</option>
<option value="5,5" id="r55" onkeyup="calcular();">06</option>
<option value="6" id="r6" onkeyup="calcular();">07</option>
<option value="6,5" id="r65" onkeyup="calcular();">08</option>
</select>
</div>
<div class="tipo_malha">
<label class="title-malha">Tipo de Malha</label>
<select class="tipo-malha" id="tipo-malha">
<option value="">Camiseta PV Branco</option>
<option value="">Camiseta PV Colorido</option>
<option value="">Camiseta Algodão Branco</option>
<option value="">Camiseta Algodão Colorida</option>
<option value="">Camiseta Dryfit</option>
<option value="">Camiseta Poliamida</option>
<option value="">Blusa Moletom Canguru</option>
<option value="">Blusa Moletom Ziper</option>
<option value="" >Polo Piquet</option>
<option value="">Polo PV</option>
</select>
</div>
<div class="valor_unit">
<label class="title-unit">Valor Unitario</label><input type="number" id="valor_unit1" name="valor-unit" value="">
</div>
</form>