I am dynamically loading script to the document by using jQuery $.getScript() method like, $.getScript("excanvas.js", function(data){});
On create canvas I applied following statement for canvas,
var canvasDiv = document.createElement('canvas');
canvasDiv.setAttribute("width", canvasBounds.width+"px");
canvasDiv.setAttribute("height", canvasBounds.height+"px");
if(window.G_vmlCanvasManager){
canvasDiv = G_vmlCanvasManager.initElement(canvasDiv);
}
and I try to draw a line on canvas, it is not working.
If I load the excanvas.js in script tag its working fine. that is like
<head>
<script src="excanvas.js" type="text/javascript"></script>
</head>
I cant find the reason. Can any one suggest a solution?
i have used it and it works for me:
After doing the top step, get the context of the canvas:
Now draw the line using the
contextvariable.