<html> <head> </head> <body> <div id = "cyclefor"> </div> <script> var cycletext = "" ; for (var i = 0; i< 10;i++) { for (var k = 0; k< 10;k++) { cycletext += String(Math.floor(Math.random()*9)) + " "; } cycletext += "<br>"; } var elemDiv = document.getElementById("cyclefor"); elemDiv.innerHTML = cycletext; </script> </body> </html>