0

Automatically Replacing an Image on an HTML Page When it is Not Found

Reference : Automatically Replacing an Image on an HTML Page When it is Not Found - CodeProject


 <div>
    <img src="error.jpg" onerror="replaceImage(this, 'replacement.jpg');"
     title="This image is replaced on an error"/>
  </div>
 
  <script type="text/javascript">
    function replaceImage(image, replacementUrl){
      image.removeAttribute("onerror");
      image.src=replacementUrl;
    }
  </script>
 
Copyright © peyotest