Connexion
S'inscrire
Actualités
Quoi de neuf
Activités générales
Auteurs
Forums
Nouveaux messages
Rechercher un forum
Quoi de neuf
Nouveaux messages
Nouveaux messages de profil
Activités générales
Membres
Membres inscrits
Visiteurs actuels
Nouveaux messages de profil
Rechercher dans les messages des profils
Teams
Créé ton équipe
Quoi de neuf ?
Nouveaux messages
Rechercher un forum
Menu
Connexion
S'inscrire
Install the app
Install
Forums
Forums généraux
Informatique
Développement
Questions, aides et recherches
Résolus
Récupération de valeurs js/html
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Vous utilisez un navigateur non à jour ou ancien. Il ne peut pas afficher ce site ou d'autres sites correctement.
Vous devez le mettre à jour ou utiliser un
navigateur alternatif
.
Répondre à la discussion
Message
<blockquote data-quote="Rivals" data-source="post: 6896983" data-attributes="member: 694298"><p>[CODE]<html></p><p><head></p><p> <meta charset="utf-8"></p><p> <title>Mon Big Guess</title></p><p> <link rel="stylesheet" type="text/css" href="flowbigguess.css"></p><p></head></p><p><body></p><p> <h1 id="titre">Mon Big Guess</h1></p><p> <div id="tableau"></p><p> <input type="text" id="afficheurleft"></p><p> <input type="text" id="afficheurright"></p><p> <button type="button" class="touche" onclick="affiche(0)">0</button></p><p> <button type="button" class="touche" onclick="affiche(1)">1</button></p><p> <button type="button" class="touche" onclick="affiche(2)">2</button></p><p> <button type="button" class="touche" onclick="affiche(3)">3</button></p><p> <button type="button" class="touche" onclick="affiche(4)">4</button></p><p> <button type="button" class="touche" onclick="affiche(5)">5</button></p><p> <button type="button" class="touche" onclick="affiche(6)">6</button></p><p> <button type="button" class="touche" onclick="affiche(7)">7</button></p><p> <button type="button" class="touche" onclick="affiche(8)">8</button></p><p> <button type="button" class="touche" onclick="affiche(9)">9</button></p><p> <button type="button" class="touche" onclick="affiche(10)">10</button></p><p> <button type="button" class="touche" onclick="affiche(11)">11</button></p><p> <button type="button" class="touche" onclick="affiche(12)">12</button></p><p> <button type="button" class="touche" onclick="affiche(13)">13</button></p><p> <button type="button" class="touche" onclick="affiche(14)">14</button></p><p> <button type="button" class="touche" onclick="affiche(15)">15</button></p><p> <button type="button" class="touche" onclick="affiche(16)">16</button></p><p> <button type="button" class="touche" onclick="affiche(17)">17</button></p><p> <button type="button" class="touche" onclick="affiche(18)">18</button></p><p> <button type="button" class="touche" onclick="affiche(19)">19</button></p><p> <button type="button" class="touche" onclick="affiche(20)">20</button></p><p></p><p></div></p><p></p><p></body></p><p><script type="text/javascript" src="codebigguess.js"></script></p><p></html></p><p>[/CODE]</p><p></p><p>[CODE]//game</p><p>var randNumber = getRandNumber();</p><p>var tours = 0;</p><p></p><p>//elements</p><p>var displayerLeft = document.getElementById('afficheurleft');</p><p></p><p></p><p>function affiche(number)</p><p>{</p><p></p><p> //si le nombre est supérieur à celui généré</p><p> if(number > randNumber)</p><p> {</p><p> console.log('inférieur');</p><p> displayerLeft.value = "Inférieur";</p><p> }</p><p></p><p> //si le nombre est inférieur à celui généré</p><p> if(number < randNumber)</p><p> {</p><p> console.log('supérieur');</p><p> displayerLeft.value = "Supérieur";</p><p> }</p><p></p><p> //si le nombre est égal à celui généré #WIN</p><p> if(number == randNumber)</p><p> {</p><p> tours += 1;</p><p> alert('Tu as gagné ! Nombre de tours : ' + tours);</p><p> getRandNumber();</p><p> }</p><p>}</p><p></p><p>function getRandNumber()</p><p>{</p><p> randNumber = Math.floor(Math.random()*20+1);</p><p> document.getElementById('afficheurright').value = randNumber;</p><p> return randNumber;</p><p>}</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="Rivals, post: 6896983, member: 694298"] [CODE]<html> <head> <meta charset="utf-8"> <title>Mon Big Guess</title> <link rel="stylesheet" type="text/css" href="flowbigguess.css"> </head> <body> <h1 id="titre">Mon Big Guess</h1> <div id="tableau"> <input type="text" id="afficheurleft"> <input type="text" id="afficheurright"> <button type="button" class="touche" onclick="affiche(0)">0</button> <button type="button" class="touche" onclick="affiche(1)">1</button> <button type="button" class="touche" onclick="affiche(2)">2</button> <button type="button" class="touche" onclick="affiche(3)">3</button> <button type="button" class="touche" onclick="affiche(4)">4</button> <button type="button" class="touche" onclick="affiche(5)">5</button> <button type="button" class="touche" onclick="affiche(6)">6</button> <button type="button" class="touche" onclick="affiche(7)">7</button> <button type="button" class="touche" onclick="affiche(8)">8</button> <button type="button" class="touche" onclick="affiche(9)">9</button> <button type="button" class="touche" onclick="affiche(10)">10</button> <button type="button" class="touche" onclick="affiche(11)">11</button> <button type="button" class="touche" onclick="affiche(12)">12</button> <button type="button" class="touche" onclick="affiche(13)">13</button> <button type="button" class="touche" onclick="affiche(14)">14</button> <button type="button" class="touche" onclick="affiche(15)">15</button> <button type="button" class="touche" onclick="affiche(16)">16</button> <button type="button" class="touche" onclick="affiche(17)">17</button> <button type="button" class="touche" onclick="affiche(18)">18</button> <button type="button" class="touche" onclick="affiche(19)">19</button> <button type="button" class="touche" onclick="affiche(20)">20</button> </div> </body> <script type="text/javascript" src="codebigguess.js"></script> </html> [/CODE] [CODE]//game var randNumber = getRandNumber(); var tours = 0; //elements var displayerLeft = document.getElementById('afficheurleft'); function affiche(number) { //si le nombre est supérieur à celui généré if(number > randNumber) { console.log('inférieur'); displayerLeft.value = "Inférieur"; } //si le nombre est inférieur à celui généré if(number < randNumber) { console.log('supérieur'); displayerLeft.value = "Supérieur"; } //si le nombre est égal à celui généré #WIN if(number == randNumber) { tours += 1; alert('Tu as gagné ! Nombre de tours : ' + tours); getRandNumber(); } } function getRandNumber() { randNumber = Math.floor(Math.random()*20+1); document.getElementById('afficheurright').value = randNumber; return randNumber; } [/CODE] [/QUOTE]
Insérer les citations…
Vérification
Publier la réponse
Forums
Forums généraux
Informatique
Développement
Questions, aides et recherches
Résolus
Récupération de valeurs js/html
Ce site utilise des cookies. En continuant à utiliser ce site, vous acceptez l'utilisation des cookies.
Acceptez
En savoir plus.…
Haut