<canvas height="200" width="300" id="myCanvas" style="border:1px solid #d3d3d3;">
var cvs = document.getElementById("myCanvas");
var ctx = cvs.getContext("2d");
ctx.fillStyle="red"; ctx.fillRect(20,30,15,25);
<!DOCTYPE html>
<html>
<head>
<title> A simple picture. </title>
</head>
<body>
<canvas height="200" width="300" id="myCanvas" style="border:1px solid #d3d3d3;">
Error, you can not create a canvas in your browser.
</canvas>
<script>
var cvs = document.getElementById("myCanvas");
var ctx = cvs.getContext("2d");
ctx.fillStyle="red";
ctx.fillRect(20,30,15,25);
</script>
</body>
</html>