+ 1

Random number

Help!!!!! blok = Math.floor(Math.random() * 100) + 1 that code for random number from 1 to 100 but that not working.

9th Sep 2017, 1:31 PM
HunterAzar
HunterAzar - avatar
10 Respostas
+ 1
is this what you wanted to do? function klik() { blok = Math.floor(Math.random() * 100) + 1 document.getElementById("blok").innerHTML = blok; klikniecia = klikniecia + skill; document.getElementById("p").innerHTML = (klikniecia); }
9th Sep 2017, 3:31 PM
Enzo
Enzo - avatar
+ 4
You have to repeatedly use the function.
9th Sep 2017, 3:20 PM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar
+ 4
Define klikniecia, I mean, initialize it
9th Sep 2017, 3:24 PM
👑 Prometheus 🇾🇬
👑 Prometheus 🇾🇬 - avatar
+ 2
works for me, maybe its a different part of your code? is there an error?
9th Sep 2017, 1:59 PM
Enzo
Enzo - avatar
+ 1
no
9th Sep 2017, 3:16 PM
HunterAzar
HunterAzar - avatar
+ 1
only number don't update
9th Sep 2017, 3:16 PM
HunterAzar
HunterAzar - avatar
+ 1
This is in function klik() function klik() { blok = Math.floor(Math.random() * 100) + 1 klikniecia = klikniecia + skill; document.getElementById("p").innerHTML = (klikniecia) }
9th Sep 2017, 3:22 PM
HunterAzar
HunterAzar - avatar
+ 1
yes
9th Sep 2017, 3:32 PM
HunterAzar
HunterAzar - avatar
0
Define klik is in button
9th Sep 2017, 3:24 PM
HunterAzar
HunterAzar - avatar
0
thanks
10th Sep 2017, 8:33 PM
HunterAzar
HunterAzar - avatar