javascript - HTML page not displaying the image -


i have following javascript file:

var canvas = document.getelementbyid('canvas'), context = canvas.getcontext('2d'), image = new image(); image.src = 'abc.jpg'; image.onload = function(){     var cols = image.width;     var rows = image.width;     canvas.width = cols;     canvas.height = rows;     context.drawimage(image, 0, 0, image.width, image.height); }; 

the html file looks follows:

<html> <head>     <title>chapter1</title>     <script src="matrix.js">     </script> </head> <body> <canvas id="canvas"></canvas>    </body> </html> 

but, when try view html page, don't see image, provided files including image in same directory.

what doing wrong?

thanks.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -