0
I have a questionnaire where the user will answer x questions and will receive a reply at the end, when you click the button "answer".
I made the first version where everything is working, except that in this version the questions are all in a single HTML page, is this way.
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 make it three to two questions per page, only I can’t think of how to make Javascript work when I put it that way.
Does anyone have any tips, or anything like that? Thank you.
see if this helps you: http://www.jquery-steps.com/Examples
– aa_sp
@aa_sp, I took a look and that’s not quite it, in fact, the merging of all the answers of all the pages will be a single result, you know.
– Brenda Xavier