awacke1 commited on
Commit
202b616
Β·
1 Parent(s): 435a856

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +19 -2
index.html CHANGED
@@ -29,6 +29,16 @@
29
  padding: 10px 20px;
30
  margin-top: 20px;
31
  }
 
 
 
 
 
 
 
 
 
 
32
  </style>
33
  </head>
34
  <body>
@@ -39,6 +49,8 @@
39
  <div class="slot" id="slot3">🍌</div>
40
  </div>
41
  <button id="spin-btn">Spin</button>
 
 
42
 
43
  <script>
44
  document.getElementById('spin-btn').addEventListener('click', function () {
@@ -46,15 +58,20 @@
46
  var slot1 = document.getElementById('slot1');
47
  var slot2 = document.getElementById('slot2');
48
  var slot3 = document.getElementById('slot3');
 
 
49
 
50
  slot1.textContent = emojis[Math.floor(Math.random() * emojis.length)];
51
  slot2.textContent = emojis[Math.floor(Math.random() * emojis.length)];
52
  slot3.textContent = emojis[Math.floor(Math.random() * emojis.length)];
53
 
54
  if (slot1.textContent === slot2.textContent && slot2.textContent === slot3.textContent) {
55
- alert('You won! πŸŽ‰');
 
 
 
56
  }
57
  });
58
  </script>
59
  </body>
60
- </html>
 
29
  padding: 10px 20px;
30
  margin-top: 20px;
31
  }
32
+
33
+ #balance {
34
+ font-size: 1.25rem;
35
+ margin-top: 10px;
36
+ }
37
+
38
+ #history {
39
+ font-size: 1rem;
40
+ margin-top: 10px;
41
+ }
42
  </style>
43
  </head>
44
  <body>
 
49
  <div class="slot" id="slot3">🍌</div>
50
  </div>
51
  <button id="spin-btn">Spin</button>
52
+ <div id="balance">Balance: $<span id="balance-amount">10</span></div>
53
+ <div id="history"></div>
54
 
55
  <script>
56
  document.getElementById('spin-btn').addEventListener('click', function () {
 
58
  var slot1 = document.getElementById('slot1');
59
  var slot2 = document.getElementById('slot2');
60
  var slot3 = document.getElementById('slot3');
61
+ var balanceAmount = document.getElementById('balance-amount');
62
+ var history = document.getElementById('history');
63
 
64
  slot1.textContent = emojis[Math.floor(Math.random() * emojis.length)];
65
  slot2.textContent = emojis[Math.floor(Math.random() * emojis.length)];
66
  slot3.textContent = emojis[Math.floor(Math.random() * emojis.length)];
67
 
68
  if (slot1.textContent === slot2.textContent && slot2.textContent === slot3.textContent) {
69
+ var winAmount = Math.floor(Math.random() * 100) + 1;
70
+ var newBalance = parseInt(balanceAmount.textContent) + winAmount;
71
+ balanceAmount.textContent = newBalance;
72
+ history.innerHTML += '<p>You won $' + winAmount + '! πŸŽ‰</p>';
73
  }
74
  });
75
  </script>
76
  </body>
77
+ </html>