I am trying to use Javascript in order to add a canvas to one page which originally does not have one. I am trying to do the following:
var canv=document.cre
Use something like Node.appendChild( child ) for adding it to the DOM:
var canv = document.createElement('canvas');
canv.id = 'someId';
document.body.appendChild(canv); // adds the canvas to the body element
document.getElementById('someBox').appendChild(canv); // adds the canvas to #someBox
Or you can use element.innerHTML:
document.body.innerHTML += ''; // the += means we add this to the inner HTML of body
document.getElementById('someBox').innerHTML = ''; // replaces the inner HTML of #someBox to a canvas