onclick event not working after ie7 reload

Posted by Charles on Stack Overflow See other posts from Stack Overflow or by Charles
Published on 2010-03-15T05:16:41Z Indexed on 2010/03/15 5:19 UTC
Read the original article Hit count: 276

I am using Javascript to dynamically create part of my page content. A routine that generates a set of img tags is called from the window.onload event. Those img tags are assigned attributes, including an onclick event. The img tags host thumbnail images that, when clicked, change the src property of the image in the main view div.

Everything works properly in FF 3.5. I can reload the page and the dynamically generated onclick events continue to fire as expected. In IE7 everything works normally until I reload the page. At that point events that were hard coded into the xhtml section continue to work as expected, and the dynamically generated img tags are shown on the page, but their onclick events fail to work.

How can I get IE7 to implement the dynamically generated click events on reload?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about internet-explorer-7