You need to use initElement. See inline
2009/3/23 Santi!# <
tia...@gmail.com>:
>
> Hello I try to draw a simple image into a canvas tag. I'm using
> ExCanvas, and can’t get any output. I attach the code. It say that de
> "The object does not accept the property or method" refer to getContext
> (). Is like IE doesn’t recognize excanvas.js
>
>
> /*************************************/
> var imgBackground = new Image();
> imgBackground.src = 'bg.png';
> imgBackground.id = 'bg_meter';
>
> var canvasOutput = document.createElement('canvas');
> canvasOutput.id = 'canvasOutput';
>
> var container = document.getElementById(div);
> container.appendChild(canvasOutput);
if (typeof G_vmlCanvasManager != 'undefined') {
G_vmlCanvasManager.initElement(canvasOutput);
}
>
> var imgWidth = imgBackground.width;
> var imgHeight = imgBackground.height;
>
> canvasOutput.width = imgBackground.width;
> canvasOutput.style.width = canvasOutput.width + 'px';
> canvasOutput.height = imgBackground.height;
> canvasOutput.style.height = canvasOutput.height + 'px';
> canvasOutput.id = 'img_meter';
>
> var bgCtx = canvasOutput.getContext('2d');
> bgCtx.save();
> bgCtx.drawImage(imgBackground, 0, 0, imgWidth, imgHeight);
> bgCtx.restore();
>
> /*************************************/
>
> Can anyone help me?
>
> Thanks for advanced.
>
> >
>
--
erik