Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image error handler

Status
Not open for further replies.

MarkJ2

Technical User
Sep 25, 2001
17
0
0
US
I am loading two images in the body of my window. One of them I am purposely writing the src attribute as incorrect so the image does not load completely.

In my Script, I have the code:
window.onerror = error Handler;

In the function 'errorHandler', I would like to write code that will change the 'ALT' text of ANY image that does not load properly to "Error Loading".

Thanks for any help.
 
instead of using the window.onerror event, use the image onerror handler:

<img src=&quot;someRandomImage.gif&quot; alt=&quot;this is a cool Picture&quot; onerror=&quot;this.alt='Error Loading Image';&quot;> Robert Carpenter
questions? comments? thanks? email me!
eclipse_web@hotmail.com
Icq: 124408594
online.dll

AIM & MSN: robacarp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top