var canvas = document.getElementById("canv");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(10, 10, 80, 80);
<script>
window.onload = function ()
{
var canvas = document.getElementById("cvs");
var context = canvas.getContext('2d');
// Fetch the context and stipulate it as having no alpha/opacity
// var context = canvas.getContext('2d', {alpha: false} );
// var context = canvas.getContext('webgl'); // WebGL 3D ontext
// var context = canvas.getContext('experimental-webgl'); // Older WebGL 3D context
}
</script>