Friday, 8 November 2013

How to make an HTML 5 US Flag

Your browser does not support the HTML5 canvas tag.

Code:

<canvas height="105" id="myCanvas" style="border: 1px solid #c3c3c3;" width="200">
Your browser does not support the HTML5 canvas tag.
</canvas>

<script>

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.fillStyle="#FF0000";
ctx.fillRect(0,0,200,5);
ctx.fillRect(0,10,200,5);
ctx.fillRect(0,20,200,5);
ctx.fillRect(0,30,200,5);
ctx.fillRect(0,40,200,5);
ctx.fillRect(0,50,200,5);
ctx.fillRect(0,60,200,5);
ctx.fillRect(0,70,200,5);
ctx.fillRect(0,80,200,5);
ctx.fillRect(0,90,200,5);
ctx.fillRect(0,100,200,5);


ctx.fillStyle="#0000FF";
ctx.fillRect(0,0,80,60);

</script>

No comments:

Post a Comment