Hi, When we ise <img src="imagename.gif" > If that image does not exist, can't we give alternative "noimage.gif" ? How do we do that in HTML? Pls. help... Thanks..
hi MeetHere, Thanks for your quick reply. But I need to put default image ( "noimage.gif ") if the original image does not exist... not the text ... Can anyone do that?
Just try javascript: <img src="image.png" alt="An Image" onerror="this.src='noimage.gif' /> Code (markup): No idea if that will work.
Hmm, if you know the size of the images (meaning, if they are all the same) you COULD maybe have a background image always there in the CSS (of the element which contains the img tag)... IF there's an image, it simply covers the background image up. If there's not an image, then of course, people can just see the background one by default. I used this trick once, works well, but only when the possble covering-up images are bigger than the default, and can be positioned exactly.