-2
I don’t know why it’s not working:
<input type="text" id="numero"/>
<input type="submit" id="adivinha" value="compare com meu segredo"/>
<script>
var segredo=[1,2,5,6,11,12,15,16];
var numero=document.getElementById("numero").value;
var botaoclicado=function() {
for(var i=0;i<segredo.lenght;i=i+1){
if(segredo[i]==numero){
alert("parabens, acertou");
return;
}
}
alert("errou");
};
var botaoadivinha=document.getElementById("adivinha");
botaoadivinha.onclick=botaoclicado;
</script>
You have to make it clearer what you want?
– gabrielhof
I think it could be much better in the explanation so it gets easier
– Otto