Advertisement
Guest User

Javascript checker board

a guest
Apr 4th, 2020
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <canvas id="gc" width="400" height="400"></canvas>
  2. <script>
  3. window.onload=function() {
  4.     canv=document.getElementById("gc");
  5.     ctx=canv.getContext("2d");
  6.     widthofCanvas=canv.width;
  7.     heightofCanvas=canv.height;
  8.     ctx.fillStyle="black";
  9.     ctx.fillRect(0,0,widthofCanvas,heightofCanvas);
  10.         ctx.fillStyle="white";
  11.        
  12.         ctx.fillRect(40,0,40,40);
  13.         ctx.fillRect(120,0,40,40);
  14.         ctx.fillRect(200,0,40,40);
  15.         ctx.fillRect(280,0,40,40);
  16.         ctx.fillRect(360,0,40,40);
  17.        
  18.         ctx.fillRect(0,40,40,40);
  19.         ctx.fillRect(80,40,40,40);
  20.         ctx.fillRect(160,40,40,40);
  21.         ctx.fillRect(240,40,40,40);
  22.         ctx.fillRect(320,40,40,40);
  23.        
  24.         ctx.fillRect(40,80,40,40);
  25.         ctx.fillRect(120,80,40,40);
  26.         ctx.fillRect(200,80,40,40);
  27.         ctx.fillRect(280,80,40,40);
  28.         ctx.fillRect(360,80,40,40);
  29.        
  30.         ctx.fillRect(0,120,40,40);
  31.         ctx.fillRect(80,120,40,40);
  32.         ctx.fillRect(160,120,40,40);
  33.         ctx.fillRect(240,120,40,40);
  34.         ctx.fillRect(320,120,40,40);
  35.        
  36.         ctx.fillRect(40,160,40,40);
  37.         ctx.fillRect(120,160,40,40);
  38.         ctx.fillRect(200,160,40,40);
  39.         ctx.fillRect(280,160,40,40);
  40.         ctx.fillRect(360,160,40,40);
  41.        
  42.         ctx.fillRect(0,200,40,40);
  43.         ctx.fillRect(80,200,40,40);
  44.         ctx.fillRect(160,200,40,40);
  45.         ctx.fillRect(240,200,40,40);
  46.         ctx.fillRect(320,200,40,40);
  47.        
  48.         ctx.fillRect(40,240,40,40);
  49.         ctx.fillRect(120,240,40,40);
  50.         ctx.fillRect(200,240,40,40);
  51.         ctx.fillRect(280,240,40,40);
  52.         ctx.fillRect(360,240,40,40);
  53.        
  54.         ctx.fillRect(0,280,40,40);
  55.         ctx.fillRect(80,280,40,40);
  56.         ctx.fillRect(160,280,40,40);
  57.         ctx.fillRect(240,280,40,40);
  58.         ctx.fillRect(320,280,40,40);
  59.        
  60.         ctx.fillRect(40,320,40,40);
  61.         ctx.fillRect(120,320,40,40);
  62.         ctx.fillRect(200,320,40,40);
  63.         ctx.fillRect(280,320,40,40);
  64.         ctx.fillRect(360,320,40,40);
  65.        
  66.         ctx.fillRect(0,360,40,40);
  67.         ctx.fillRect(80,360,40,40);
  68.         ctx.fillRect(160,360,40,40);
  69.         ctx.fillRect(240,360,40,40);
  70.         ctx.fillRect(320,360,40,40);
  71.        
  72.         }
  73. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement