I scripted a function in javascript that takes an image src and then sets a new Image() to have the src. Once the image is loaded, it gets displayed.

Code:
var new_image = new Image();
new_image.src=newImageSrc;
new_image.onload = function() { ... }
I noticed that the code works in firefox, but not in IE. I found this to be a problem since the onload attribute works perfectly fine when coded into the html for Internet Explorer.

However, it doesn't work when coded through javascript.

Is there anyway to get the onload listener for images to work in IE?