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="Vatinj-NayLeeQ SEE" data-source="post: 6896900" data-attributes="member: 6150"><p style="text-align: center">Bonjour à tous !</p> <p style="text-align: center"></p> <p style="text-align: center">Voilà mon problème est le suivant j'ai une suite de boutons chacun de ces boutons vont de 1 à 20.</p> <p style="text-align: center">j'ai deux textbox une qui affiche la valeur sur laquelle on a cliqué et l'autre qui indique un plus ou moins, je n'arrive pas à récupérer la valeur du bouton et à la comparer à celle enregistrée par l'ordinateur.</p> <p style="text-align: center"></p><p>[HTML]<!DOCTYPE html></p><p><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> <script type="text/javascript" src="codebigguess.js"></script></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></html></p><p>[/HTML]</p><p></p><p>[CODE]var rand = Math.floor(Math.random()*20+1);</p><p>var tours = 0;</p><p>var nombre;</p><p>var a;</p><p></p><p>document.getElementById('afficheurleft').addEventListener('onclick', nombre);</p><p></p><p>function nombre() {</p><p></p><p> nombre = document.getElementById('button').value;</p><p></p><p> //parseInt(nombre);</p><p></p><p> if (nombre === rand) {</p><p> alert('T\'as gagné en '+ tours +' tours fdp');</p><p> } else if (nombre < rand) {</p><p> alert('C\'est + pd');</p><p> tours++;</p><p> } else if (nombre > rand) {</p><p> alert('C\'est - enculé');</p><p> tours++;</p><p> } else {</p><p> alert('C\'est pas un nombre putain.');</p><p> }</p><p>}</p><p></p><p>/* function affiche(par)</p><p>{</p><p> a = document.getElementById("afficheurleft");</p><p></p><p> if(par=='c'){</p><p> a.value='';</p><p> }</p><p> else {</p><p> a.value=a.value+par;</p><p> }</p><p> console.log(affiche);</p><p>} */[/CODE]</p></blockquote><p></p>
[QUOTE="Vatinj-NayLeeQ SEE, post: 6896900, member: 6150"] [CENTER]Bonjour à tous ! Voilà mon problème est le suivant j'ai une suite de boutons chacun de ces boutons vont de 1 à 20. j'ai deux textbox une qui affiche la valeur sur laquelle on a cliqué et l'autre qui indique un plus ou moins, je n'arrive pas à récupérer la valeur du bouton et à la comparer à celle enregistrée par l'ordinateur. [/CENTER] [HTML]<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Mon Big Guess</title> <link rel="stylesheet" type="text/css" href="flowbigguess.css"> <script type="text/javascript" src="codebigguess.js"></script> </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> </html> [/HTML] [CODE]var rand = Math.floor(Math.random()*20+1); var tours = 0; var nombre; var a; document.getElementById('afficheurleft').addEventListener('onclick', nombre); function nombre() { nombre = document.getElementById('button').value; //parseInt(nombre); if (nombre === rand) { alert('T\'as gagné en '+ tours +' tours fdp'); } else if (nombre < rand) { alert('C\'est + pd'); tours++; } else if (nombre > rand) { alert('C\'est - enculé'); tours++; } else { alert('C\'est pas un nombre putain.'); } } /* function affiche(par) { a = document.getElementById("afficheurleft"); if(par=='c'){ a.value=''; } else { a.value=a.value+par; } console.log(affiche); } */[/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