![]() |
Here is simple way to set multiple Image if First Image is error. This function is called Fallback. |
See the Example.
You can add multiple image using 'https://cdn-icons-png.flaticon.com/128/6912/6912971.png' into the code.
<script>
function incrementFallbackSrc(img, srcs) { if (typeof img.fallbackSrcIndex === 'undefined') img.fallbackSrcIndex = 0; img.src = srcs[img.fallbackSrcIndex++];
}
</script>
<img
src="https://cdn-icons-png.flaticon.com/128/8067/8067997.png"
onerror="javascript: incrementFallbackSrc(this, ['https://cdn-icons-png.flaticon.com/128/8067/8067999.png',
'https://cdn-icons-png.flaticon.com/128/6912/6912971.png'
])">
html image error |
Type
: |
Develop |
Category
: |
Web Tutorial |
Sub Category
: |
HTML Image Tutorial |
Uploaded by
: |
Admin |