HTML5 canvas using JavaScript

The canvas is HTML5 element used to draw graphics using JavaScript. 

<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" style="border:1px solid #000000;">Your browser does not support the HTML5 canvas tag.</canvas>
<script>
var c=document.getElementById('myCanvas');
var ctx=c.getContext('2d');
//ctx.fillStyle='#FF0000';
for (var x = 0, y = 0; x < 150 &amp;&amp; y < 200; x += 50, y += 37) {
var i = x+125;
var color ='FF0'+i;
//alert(color);
ctx.fillStyle='#'+color;
ctx.fillRect(x,y,60,60);
}

</script>
</body>
</html>
<div> 

Demo :

Pankaj Singh Sugara

Author Pankaj Singh Sugara

Experienced Software Engineer with a demonstrated history of working in the marketing and advertising industry. Skilled in SQL, Web Applications, PHP, WordPress, and Joomla. Strong engineering professional with a B-TECH focused in Information Technology from JCDM College of Engineering Sirsa, Haryana.

More posts by Pankaj Singh Sugara