<img src="small-image.gif" onclick="return LargePicturePopup('large-picture.gif');" />
Now a better solution would be to attach an event to the HTML element through script. This can be done from an external script file. We need to lookup the thumbnail in the DOM and then call addEventListener on it to attach our function to it. How hard can that be right? Well as it turns out, not so easy. IE does not support addEventListener for starters. And how do we look up the element? And more tricky, when do we look it up? If our script runs while the element we want to attach to is not even read by the browser yet, what happens then?
This blog talks about these issues and underway tries to answer all questions asked above and some more. I hope you’ll enjoy reading it.