Javascript examples for Canvas:Rectangle
Canvas fill a rectangle
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(function(){//from ww w.j a v a2s . c o m var canvas = document.getElementById("canvas-one"); var context = canvas.getContext("2d"); context.rect(20, 30, 360, 240); context.fillStyle="#990000"; context.fill(); }); </script> </head> <body> <canvas id="canvas-one" width="360" height="240" style="border:1px"> <p>You don't support the 'canvas' element? Better get to fixing that.</p> </canvas> </body> </html>