Spicke

1214

Apr 13th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. </head>
  4. <script type="text/javascript">
  5. function rand(min, max)
  6. {
  7.     max = max || false;
  8.     min = min || 255;
  9.    
  10.     if (max)
  11.     {
  12.         return Math.floor(Math.random()*(max-min+1))+min;
  13.     }
  14.     else
  15.     {
  16.         return Math.floor(Math.random()*(min+1));
  17.     }
  18. }
  19.  
  20. function zapolnenie(){
  21.     var matrixBig = [];
  22.     for(y = 0; y<6; y++){
  23.         matrixBig[y] = [];
  24.         for( x = 0; x<6; x++)
  25.             matrixBig[y][x] = rand(10,100);
  26.     }
  27.     return matrixBig;
  28. }
  29.  
  30. function printMatrix(matrix){
  31.     if (!matrix instanceof Array)
  32.         return;
  33.     document.write("<table border=1>");
  34.     for(y = 0; y < matrix.length; y++){
  35.         for(x = 0; x < matrix[y].length; x++){
  36.             document.write('<td>',matrix[y][x],'</td>');
  37.         }
  38.         document.write('</tr>');
  39.     }
  40.     document.write('</table>');
  41. }
  42. </script>
  43. <body onload = printMatrix(zapolnenie())>
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment