Created
October 5, 2012 12:21
-
-
Save dator-zz/3839518 to your computer and use it in GitHub Desktop.
CorrectionTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
<link rel="stylesheet" type="text/css" href="main.css"> | |
</head> | |
<script type="text/javascript"> | |
var compteur = 5, | |
nb = Math.floor(Math.random() * 100), | |
resp = null; | |
do { | |
resp = prompt('Trouve le nombre ('+nb+')entre 1 et 100, il vous reste '+compteur+' chances'); | |
if(resp > nb){ | |
alert("C'est plus petit"); | |
compteur--; | |
} else if(resp < nb) { | |
alert("C'est plus grand"); | |
compteur--; | |
} else { | |
document.write('Gagné'); | |
} | |
if(compteur == 0) { | |
alert('perdu'); | |
break; | |
} | |
}while(nb != resp); | |
</script> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment