Monday, September 4, 2017

Show alternate image if source image is not found

Show alternate image if source image is not found


To make an image showing alternate source when the main one is not found, you simply bind the onerror event on the image like the following:

<img src="imagenotfound.gif" alt="Image not found" onerror="this.onerror=null;this.src=imagefound.gif;" />


Reference: http://stackoverflow.com/questions/3984287/how-to-show-alternate-image-if-source-image-is-not-found-onerror-working-in-ie

download file now

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.