1

I have seen code for replacing a broken image with javascript using onerror, but I have a situation where I'm not sure what image is going to be available for a replacement, so I need to do multiple checks and I'm not sure how... Here's an example of what I need...

<img src="http://www.example.com/myimage1.png">

If that image isn't available, I need to check a different location for an image. that location will be...

<img src="http://www.example.com/myimage2.png">

If that image isn't available, I need to check,

<img src="http://www.example.com/myimage3.png">

and finally, if that image isn't available, I use my default image that I know is always available

<img src="http://www.example.com/default.png">

javascript only please, no jquery

CheeseFlavored
  • 1,922
  • 1
  • 21
  • 28
  • I do know how to replace ONE broken image, but not sure how to do it if the replacement is also broken, and keep checking a few images until I find one that works. – CheeseFlavored Apr 07 '19 at 05:27

0 Answers0