通过对图片大小的判断来处理
$(window).load(function () {
$('img').each(function () {
var error = false;
if (!this.complete) {
error = true;
}
if (typeof this.naturalWidth != "undefined" && this.naturalWidth == 0) {
error = true;
}
if (error) {
this.src = "images/01.jpg";
}
});
});
网友评论