[whatwg] Canvas and Image problems

Hi everyone,

 

Having a really weird problem that I would like some input on. I am trying
to draw an image, as well as video, onto canvas. I use the simple code
below:

 

$(document).ready(function() {

      var image = $("#cat").get(0);

      

      var cv = $("#img_container").get(0);      

      var ctx = cv.getContext('2d');

      

      ctx.drawImage(image, 0, 0);

});

 

When I load up the HTML page in Chrome absolutely nothing happens and I see
no errors in the JavaScript console. When running it in Firefox 3.6.3 I get
the following error:

 

uncaught exception: [Exception... "Component returned failure code:
0x80040111 (NS_ERROR_NOT_AVAILABLE)
[nsIDOMCanvasRenderingContext2D.drawImage]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
file:///C:/thelab/HTML5Canvas/scripts/canvas_img.js
<file:///C:\thelab\HTML5Canvas\scripts\canvas_img.js>  :: anonymous :: line
9" data: no]

 

For The life of me I cannot see what I am doing wrong with the above. I have
done console logs to ensure that the code get's the image as well as the
canvas on the relevant lines and it definitely does. Anything I am
overlooking?

 

Thank you all in advance,

Schalk

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20100523/1eae95af/attachment.htm>

Received on Sunday, 23 May 2010 03:16:00 UTC