如何知道图像是否无法加载javascript?

时间:2012-09-27 07:54:57

标签: javascript jquery asp.net html web

有没有办法知道某些图片无法在jquery / javascript中加载到网页中。

1 个答案:

答案 0 :(得分:5)

使用: .error()

$('img').error(function() {
  alert('Failed to load the image with src: ' + $(this).attr('src'));
});