555388-1-ref.html (565B)
1 <html> 2 <head> 3 <script type="application/javascript"> 4 function draw() { 5 var canvas = document.getElementById("canvas"); 6 var ctx = canvas.getContext("2d"); 7 8 ctx.fillStyle = "red"; 9 ctx.beginPath(); 10 ctx.moveTo(0, 0); 11 ctx.lineTo(300, 0); 12 ctx.lineTo(300, 300); 13 ctx.lineTo(0, 300); 14 ctx.lineTo(0, 0); 15 ctx.moveTo(30, 30); 16 ctx.lineTo(30, 150); 17 ctx.lineTo(150, 150); 18 ctx.lineTo(149, 30); 19 ctx.lineTo(30, 30); 20 ctx.fill(); 21 } 22 </script> 23 </head> 24 <body onload="draw()"> 25 <canvas id="canvas" width="300" height="300"></canvas> 26 </body> 27 </html>