function tab(n,m){ document.write("<table border=1 cellpadding=0 cellspacing=0 >"); for(var i=0; i<n; i++){ document.write("<tr>"); for(var j=0; j<m; j++){ document.write("<td style=‘width: 40px; height: 40px;‘>"); document.write( Math.round( Math.random()*100 ) ); document.write("</td>"); } document.write("</tr>"); } document.write("</table>"); } tab(10,10);