+ 1

Can an img tag have two alternates?

Can you have two alternates. For example if the first image can not be retrieved and the second alternate image can not be retrieved then can you have a third alternate with an "image not found" prompt?

1st Dec 2016, 9:06 AM
EXO L
EXO L - avatar
4 odpowiedzi
+ 3
No. You can only have 1 alt attribute for a tag.
1st Dec 2016, 9:29 AM
Gilson Gilbert
Gilson Gilbert - avatar
+ 3
yes you can do it by using scripts in javascript image.onload tells whether the image was loaded or not if not you can set its SRC by image.src=.... then call it again image.... alt attribute is not for alternative image it is alternative text for prompt there is alert("image not found')
1st Dec 2016, 12:32 PM
Sandeep Chatterjee
+ 2
I think it can't.
1st Dec 2016, 9:10 AM
Nguyễn Hoàng Long
Nguyễn Hoàng Long - avatar
+ 1
Thanks Sandeep
1st Dec 2016, 6:43 PM
EXO L
EXO L - avatar