Image failed to load module design

When we have failed to load the image resources, we can use another picture to replace the position of the load failed

 

At this point you can use to picture the error event to load another picture

 

Specific code as follows

<img src='1.jpg'>

window.addEventListener('error',function(){
    

})

  

Guess you like

Origin www.cnblogs.com/qqfontofweb/p/11415462.html