using canvas in html code example
Example 1: javascript create canvas
var canvas = document.createElement("canvas"); //Create canvas
document.body.appendChild(canvas); //Add it as a child of <body>
Example 2: javascript canvas
#this code creates a circle within a canvas that must be created in HTML
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(95, 50, 40, 0, 2 * Math.PI);
ctx.stroke();
Example 3: canvas in javascript
<!DOCTYPE HTML>
<html>
<head>
<style>
#mycanvas{border:1px solid red;}
</style>
</head>
<body>
<canvas id = "mycanvas" width = "100" height = "100"></canvas>
</body>
</html>
Example 4: html5 canvas
<canvas id="" width="" height=""></canvas>
<script>
</script>