My question is as follows:
<!DOCTYPE html>
<html dir="ltr" lang="pt-BR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Joguinho</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="container">
<?php
$contador = 0;
$random1 = (rand(1,10));
$random2 = (rand(1,10));
$resultado = $random1 * $random2;
$contador++;
echo("<div id='contador'>".$contador."/10"."</div>");
echo("<div id='campo'>".$random1."x".$random2."</div>");
?>
<input id="digiteValor" type="text" />
<button id="enviar" onclick="chama()">Enviar</button>
<div id="certoOuErrado"></div>
</div>
</body>
<script type="text/javascript">
function chama(){
var valorDigitado = document.getElementById('digiteValor').value;
var resultado = "<?php echo $resultado; ?>";
//var correto = "<div id='correto'></div>";
//var incorreto = "<div id='incorreto'></div>";
if(resultado == valorDigitado){
document.getElementById('certoOuErrado').innerHTML = "CORRETO";
//document.getElementById('certoOuErrado').innerHTML = correto;
} else {
document.getElementById('certoOuErrado').innerHTML = "INCORRETO";
//document.getElementById('certoOuErrado').innerHTML = incorreto;
}
}
</script>
</html>
This is the code I've done so far
The idea is for the guy to enter the value, take the time to check if the answer is right or wrong. I have a counter that should count 10 moves, it's like a loop. Can you give refresh on the screen and keep updating this data until 10 plays? There has to be some time for him to respond. for example: it has 4sec to respond, after the time is finished it is verified if the value entered is correct or incorrect, then goes to the next iteration.