I would like to know how to call more than one function with just one "Click".
window.onload = function(){
var btn = document.getElementById("resposta");
btn.addEventListener("click",function(){
var nomedoCliente = parseFloat(document.getElementById("nmCliente").value)
calcular(nomedoCliente);
},false);
function calcular(a){
var xNmCliente = document.getElementById("nmCliente").value
var xVidas = document.getElementById("vidas").value
var xMarca = document.getElementById("marca").value
var a = 0
var execucao
var coringa = 0
if (xVidas == "vidas1" && xMarca == "marca1" ) {
a=1
}
else if (xVidas == "vidas1" && xMarca == "marca2" ) {
a=1
}
else if (xVidas == "vidas2" && xMarca == "marca1" ) {
a=4
}
else if (xVidas == "vidas3" && xMarca == "marca1") {
a=3
}
else {
coringa=0
}
if(xMarca=="marca1" && a =="3"){
execucao = 34
}
else if (xMarca =="marca2" && a=="1"){
execucao = 88
}
else{
execucao == 0
}
}
}
<p>Quantas vidas temos?</p>
<select id = "vidas">
<option value="vidas1" >Menos 1000</option>
<option value="vidas2" >1000 a 5000</option>
<option value="vidas3" >Mais de 5000</option>
</select>
<p >O quanto nossa marca é importante para a Operadora?</p>
<select id = "marca">
<option value="marca1" >Pouco Importante</option>
<option value="marca2" >Importante</option>
<option value="marca3" >De relevância estratégica</option>
</select></br>
I would like to get the result of a
, as in this other if
, to get the result of Execucao
.
Is it possible to do everything in just one function?
That way I put in nothing happens when I press Resultado
. I've looked at other topics, but you're not doing much of it.