I would like to be able to make Canvas elements from the constructor so that I could make a function like this.
function createCanvasContext(height,width)
{
v
var mycanvas = document.createElement("canvas");
mycanvas.id = "mycanvas";
document.body.appendChild(mycanvas);
While you can do new Image()
just fine, new Canvas()
isn't a thing! Canvas
Isn't even a thing, though HTMLCanvasElement
is. Nonetheless you cannot use its constructor.
document.createElement('canvas');
is what you want. You have to use that, just like with divs.