Javascript – IE 6 Images are not shown

image, internet-explorer, javascript

I have a dynamic div created which contains text + images. These images are shown well in all browsers, except IE6. I need to do a right click show pictures, then they come. Looks like its a bug with IE.

Best Solution

I've done a lot of DHTML in IE6 and have not come across this problem. However, given the strange behavior of IE6 in general, nothing surprises me. In cases such as this, I suggest a bit of "riffing". For instance, if you append an img tag to an element while the parent element's display property is none, IE6 may lazily decide not to load it. Try setting display to block prior to appending the img element. Or, if the img tag already exists, try waiting until after the container is shown before setting the src attribute of the tag. Lastly, if you're updating the HTML of the div by changing the innerHTML property, try using DOM methods like addChild instead.