Guys,I need some html,js code that click the button and alert random between 1-50 ,pls ya | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys,I need some html,js code that click the button and alert random between 1-50 ,pls ya

29th Aug 2016, 11:55 AM
DK-deadAnzle
DK-deadAnzle - avatar
2 Answers
+ 2
<button onclick="run()">Generate number</button> <p id="p"> </p> <script> function run() { //alert(Math.floor(Math.random()*50)+1); alert((Math.random()*50|0) +1); } </script>
29th Aug 2016, 1:35 PM
freshnewname
freshnewname - avatar
0
Thnx I forget to told that I want .onclick event but really thnx :)
30th Aug 2016, 7:02 AM
DK-deadAnzle
DK-deadAnzle - avatar