JS使用默认图片代替页面上无法显示的图片

1.js方法:
function replaceErrorImg(obj) { obj.src="images/common/error.bmp"; } 2.jquery绑定 $('img').error(function() { $(this).attr("src", "images/common/error1.gif"); });

  

原文地址:https://www.cnblogs.com/rnckty/p/4094231.html