Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. <!doctype html>
  2.  
  3.  
  4. <head>
  5. <title> Roulette </title>
  6.  
  7. <h1> Roulette </h1>
  8.  
  9. </head>
  10. <body>
  11. <h2> Regole della roulette </h2>
  12. <p> Scommetti una puntata minima di 2 euro, la massima è illimitata. </p>
  13. <p> Vinci il doppio della puntata</p>
  14.  
  15.  
  16.  
  17. <script type="text/javascript">
  18.  
  19.  
  20. function lancio()
  21. {
  22. var x = Math.floor((Math.random() * 37) + 0),n_scommesso,puntata;
  23. document.getElementById("numero").innerHTML = x;
  24. puntata= Number(document.getElementById("puntata").value) <!----qua andrà inserito l'importo sul quale si vuole scommettere >
  25. if (x == n_scommesso)
  26. {
  27. document.getElementById("vincita").innerHTML = "Hai vinto" ;
  28. }
  29. else
  30. {
  31. document.getElementById("perdita").innerHTML = "Hai perso" ;
  32. }
  33. }
  34.  
  35.  
  36. function numero() {
  37. var n_scommesso; <!----qua andrà inserito il numero sul quale si vuole scommettere >
  38. n_scommesso=Number(document.getElementById("n_scommesso").value);
  39. }
  40.  
  41.  
  42. </script>
  43.  
  44. <button type="button" onclick = "lancio()"> Gioca </button>
  45. <p id="numero"></p>
  46. <p id="vincita"></p>
  47. <p id="perdita"></p>
  48.  
  49. Inserisci l'importo sul quale vuoi scommettere <input id="puntata" type="number" min="2"><hr>
  50. Su quale numero vuoi scommettere? <input id="n_scommesso" type="number"><hr>
  51. </body>
  52. </html>
  53. <!----http://previews.123rf.com/images/michelangelus/michelangelus1404/michelangelus140400017/27368520-Europeo-vettore-tavolo-della-roulette-Archivio-Fotografico.jpg>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement