JavaScript. It can be used to draw graphs, make photo compositions or do simple (and not so simple) animations. Hereis a simple element which has only two specificattributes width and height plus all the core HTML5 attributes like id, name and class, etc. You can easily find that element in the DOM using getElementById() method as follows – var canvas = document.getElementById("mycanvas"); Let us see a simple example on using element in HTML5 document. The Rendering Context The is initially blank, and to display something, a script first needs to access the rendering context and draw on it. The canvas element has a DOM method called getContext, used to obtain the rendering context and its drawing functions. This function takes one parameter, the type of context2d. Following is the code to get required context along with a check if your browsersupports element − P