function Up () { var ctx = document.getElementById('canvas').getContext('2d'), img = new Image(), img.src = "ava1.png", img.src = src; img.onload = function() { context.drawlmage(img, 0, 0, 480, 402); } } <button type="button" onclick="Up()" >add logo</button> <canvas id="canvas" width="480" height="402"></canvas> when you press a button, nothing happens. why is that?