So I currently have an image on a canvas and I want the page to reload once you click the image. The problem is that the page is reloading as soon as the "Go" function is called and not when the click event is initiated. Here is the bit of code.
function Go()
{
myimage = new Image();
myimage.src = "http://i.imgur.com/xcLDp.gif";
ctx.drawImage(myimage, 294, 100);
myimage.onClick = window.location.reload();
}
I feel like I'm missing something trivial, any help would be appreciated.
Thanks.
Regards,
Matt
Edit: Added for Derek.
Hey Derek I really appreciate the help. I'm going to be real noob with you for a second as I'm pretty new to coding. So I'm trying to implement the demo code you've shown me on my test website here but the error I get back is "Uncaught ReferenceError: $ is not defined".
Now what I know is that "$" is a jQuery symbol, now I'm pretty new to coding/javascript in general so just imagine how new I am to javascript libraries (jQuery).
I've downloaded jQuery and put it in the same directory then added this line to the html:
<script src="jquery-1.7.2.js" type="text/javascript"></script>
Am I doing something wrong? Why is it not picking up on the jquery library?