1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title> </title> </head>
<body>
<h1>Testeur anti-robots </h1>
<script>
var a= Math.floor((Math.random()*10));
var b= Math.floor((Math.random()*10));
var c=a*b;
<!-- document.forms.f.resultat.value est ce que l'utilisateur a saisi dans le champ resultat du formulaire f -->
function verif1 (nombre) {if(parseInt(document.forms.f.resultat.value)==nombre)
{alert('OK, VOUS ETES UN HUMAIN.'); }
else alert("VILAIN ROBOT !");}
</script>
<h2>a vaut <script>document.write(a)</script> et b vaut <script>document.write(b)</script>.</h2>
<h2>Combien vaut a*b ?</h2>
<form name="f" >
<p><input type="text" name="resultat" value=""></p>
<p><INPUT type='button' value='Validation 1' onClick="verif1(c)"></p>
</form>
</body> </html> |