canvas_test_01

w/ jquery, html canvas w/ rect loads on document ready. canvas has css styles

by Nic Fontaine

HTML

<canvas id="myCanvas" height="300px" width="400px"></canvas>
<p id="demo"></p>

CSS

#myCanvas { background-color: #ddd;
}

JavaScript

$(document).ready(function () {
        rect01();
});

function rect01() {
    var can = document.getElementById("myCanvas");
    var ctx = can.getContext("2d");
    ctx.fillStyle = "blue";
    ctx.fillRect(0,0,50,50);
    
}