Javascript examples for Canvas:Example
calling Canvas Functions
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> <style id="compiled-css" type="text/css"> #canvas {/*from ww w .j a va 2 s.c om*/ background: yellow; } </style> <script type="text/javascript"> $(window).load(function(){ var canvas = document.getElementById('canvas'); if (canvas.getContext){ var ctx = canvas.getContext('2d'); ctx.fillStyle = "#F0F"; var args = [ 10, 10, 180, 180 ]; var op = "fillRect"; (ctx[op]).apply(ctx, args); } }); </script> </head> <body> <canvas id="canvas" width="300" height="300"></canvas> </body> </html>