+ 1
Random number
Help!!!!! blok = Math.floor(Math.random() * 100) + 1 that code for random number from 1 to 100 but that not working.
10 Antworten
+ 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);
}
+ 4
You have to repeatedly use the function.
+ 4
Define klikniecia, I mean, initialize it
+ 2
works for me, maybe its a different part of your code? is there an error?
+ 1
no
+ 1
only number don't update
+ 1
This is in function klik()
function klik() {
blok = Math.floor(Math.random() * 100) + 1
klikniecia = klikniecia + skill;
document.getElementById("p").innerHTML = (klikniecia)
}
+ 1
yes
0
Define klik is in button
0
thanks