<img src="image.svg" onerror="this.onerror=null; this.src='image.png'">


完美

 

 

里面写,this.onerror=null; this.src='image.png'

this.onerror=null;会让他不能重复使用,

 

为了重复能使用,不加this.onerror=null;就可以

如果还是有问题

 

  <img class="woimg1" onerror="javascript:somgfun();" src="">
function somgfun(){

    var a = "https://www.cnblogs.com/images/logo_small.gif";
    $('.woimg1').attr('src',a);
}

 

相关文章:

  • 2022-12-23
  • 2022-01-11
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2022-02-10
  • 2022-12-23
  • 2021-10-02
相关资源
相似解决方案