I am trying to load a simple image using javascript, for that I am using following code
function loadImage(src) {
var image = new Image;
image.onload = function() {
document.body.appendChild(image);
};
image.onerror = function() {
document.body.appendChild(document.createTextNode('\nError loading as image: ' + this.src));
};
image.src = src;
}
loadImage('http://www.linkedin.com/favicon.ico');
loadImage('http://www.facebook.com/favicon.ico');
The problem I am facing is whole thing working in chrome and firefox but not working in internet explorer. I am not much used to with javascript.
Any solutions ?