how can I set the number inside table to change randomly | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can I set the number inside table to change randomly

26th Oct 2016, 11:46 AM
Samoburger
Samoburger - avatar
2 Answers
+ 3
This can help. <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <table> <tr> <td id="randInt"></td> </tr> </table> <script> function randGenerate () { var random = Math.floor(Math.random() * 100); return random; } document.getElementById("randInt").innerHTML = randGenerate() </script> </body> </html>
26th Oct 2016, 1:15 PM
Clark Estreller
Clark Estreller - avatar
0
what do you mean change randomly? at this stage all content is inputted into do manually.
26th Oct 2016, 12:09 PM
Mehluli Hikwa
Mehluli Hikwa - avatar