I have a questionnaire where the user will answer x questions and will receive a response at the end, when you click the "answer" button.
I made the first version where everything is working, except that in this version the questions are all in a single HTML page, that's how it is.
window.onload = function(){
var btn = document.getElementById("resposta");
btn.addEventListener("click",function(){
var nomeCL = parseFloat(document.getElementById("nmCliente").value)
calcular(nomeCL);
},false);
function calcular(a){
var teste = document.getElementById("nmCliente").value
var idade = document.getElementById("vlIdade").value
if(teste == "Joll" && idade == "a"){
document.getElementById("resultado").innerHTML="<p>a</p>"
}else{
document.getElementById("resultado").innerHTML="<p>b</p>"
}
}
}
<p>Nome do Cliente:</p>
<input id="nmCliente" type='text'></input>
<p>Qual sua idade?</p>
<select>
<option value="a" id="vlIdade">15</option>
<option value="b" id="vlIdade">16</option>
<option value="c" id="vlIdade">17</option>
</select>
<div>
<input type="button" id="resposta" value="Calcular" /></br>
Resultado: <span id="resultado"> </span>
</div>
Now I want to add a "Next" button, to leave three to two questions per page, but I can not think of how to make Javascript work when I put it that way.
Does anyone have any tips, or anything like that? Thanks.