Use replace the picture does not show the picture - the simplest way to achieve

1, img alt attribute, in case the picture does not exist, parsing each browser is not the same

2, the chrome shows a broken image, is displayed in the alt ff text displayed in IE is broken and text image

3、

<img src="错误.jpn" alt=""  onerror="showerrimg(this)">
function showerrimg (obj) {
       var errorimg = "replace image .jpg"; // replace image address 
      obj.src = errorimg;
    }

 

Reproduced in: https: //www.cnblogs.com/congfeicong/p/11051389.html

Guess you like

Origin blog.csdn.net/weixin_34210740/article/details/93629759