PDA

View Full Version : onerror image.src


jeorg
07-18-2002, 06:09 PM
<img id="Imag" src="image.gif" onerror='this.src=errorImage.gif;'/>

this script doesn't work why ? how can I change an image if it doesn't exists ?

thank you

jeorg
07-18-2002, 06:20 PM
<img src="test.jpg" border="0" onerror="this.src='not.gif'"/>

it works but I have a message stack overflow ?!!

neil.c
07-18-2002, 09:31 PM
<img src="test.jpg" border="0" onerror="this.src='not.gif'"/ >
why is there a / slash at the end of your tag?

redhead
07-18-2002, 09:43 PM
<img src="image.jpg" onerror="this.src='error.jpg';" /> should work fine...

the slash "/" is in to make it complatable with XHTML, as all tags need to be closed. (eg: <p></p>... <br /><hr />....)

happy coding :thumbsup:

jeorg
07-19-2002, 05:06 AM
thank you it works

for XHTML also meta tags
<meta></meta>
or <meta/>