i want to add image using javascript but it is not working
html code:
<body onload="init()"> <canvas id="canvas" width="640" height="480"> <p>your browser doesnot support html5 canvas.</p> </canvas> <script src="script.js"> </script> </body> and this is javascript:
var canvas; var context; function init() { canvas = document.getElementById("canvas") context = canvas.getContext("2d"); console.log("loading comepletd"); var image = new Image(); image.src = "ball.png"; }