Adding a comment for clarity
I have access to the image tag. Why make javascript do the work?
Make sure the method exists before calling it, so it doesn't blow up.