regicidedelferoz
01-06-2012, 09:30 AM
good day everyone,
hi can anybody here wanna help me?
i want to replace missing images automatically on load of the page,.
i got some code on the net but it doesn't work on IE,. here's the code,.
for (var i=0; i<document.images.length; i++){
img = new Image();
img.src = document.images[i].src;
if (img.height == 0)
document.images[i].src = '<?php echo $livesitePath; ?>images/picnotavailable.jpg';
}
here's another one that is not workingon IE,.
$(window).load(function() {
$('img').each(function() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0 || this.src=="") {
// image was broken, replace with your new image
this.src = '<?php echo $livesitePath; ?>images/picnotavailable.jpg';
}
});
});
hi can anybody here wanna help me?
i want to replace missing images automatically on load of the page,.
i got some code on the net but it doesn't work on IE,. here's the code,.
for (var i=0; i<document.images.length; i++){
img = new Image();
img.src = document.images[i].src;
if (img.height == 0)
document.images[i].src = '<?php echo $livesitePath; ?>images/picnotavailable.jpg';
}
here's another one that is not workingon IE,.
$(window).load(function() {
$('img').each(function() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0 || this.src=="") {
// image was broken, replace with your new image
this.src = '<?php echo $livesitePath; ?>images/picnotavailable.jpg';
}
});
});