Javascript examples for Canvas:Rectangle
Fill rectangle on canvas with html5 canvas units
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {/*from w ww .j ava2s . c o m*/ var can = document.getElementById('canvas1'); var ctx = can.getContext('2d'); ctx.fillRect(400,200, 50,50); }); </script> </head> <body> <canvas id="canvas1" width="800" height="400" style="border: 1px solid black;"></canvas> </body> </html>