473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to change the pic to a "show error" image when loading imagesfailed?

How to change the pic to a "show error" image when loading images failed
- for example, no image file exists?

I tried to add the following statement in the onload event function:

if (!document.images.AImage.complete) { document.images.AImage.src =
"error.gif";); }

However, I found that a lot of images can be successfully loaded will
also be replaced with the "error.gif".

After remove above line, these exist images can be show successfully.
But I want to change the non-exist images src to the error.gif....
Jul 20 '05 #1
1 2283
Nick wrote:
How to change the pic to a "show error" image when loading images failed
- for example, no image file exists?

I tried to add the following statement in the onload event function:

if (!document.images.AImage.complete) { document.images.AImage.src =
"error.gif";); }

However, I found that a lot of images can be successfully loaded will
also be replaced with the "error.gif".

After remove above line, these exist images can be show successfully.
But I want to change the non-exist images src to the error.gif....


use the eventhandler named: onAbort() or onError() or both.

I think onError() it will do just that. :-)

<img src="nonexistant.gif" onError="alert('help me!');">

Regards,
Erwin Moller
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Gary McGill | last post by:
I have a C# solution with a dozen or so projects. There are references between the projects, and these were all added as "Project" references. Everything's been working fine for months, but...
1
by: AA Arens | last post by:
To have the first character of a fiels capitalized AfterUppdate, I used the following script: Me!City = UCase$(Left$(Me!City, 1)) + Mid$(Me!City, 2) UCase (Left(Me!City, 1)) + Mid(Me!City, 2) ...
1
by: Greg Burns | last post by:
--------------------------- Microsoft Development Environment --------------------------- The Web server reported the following error when attempting to create or open the Web project located at...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
2
by: szechi | last post by:
Greetings, I am facing the following error when trying to use DB2 import command under DB2 version 7.2. SQL3040N Unable to use the lobpath/lobfile parameters as specified. Reason code: "1" ...
7
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement...
1
by: dmorand | last post by:
I'm having an issue with displaying asp pages on my server. I've determined it's obviously something with only asp because html pages display fine. I'm getting this error when I launch my asp page:...
11
by: fniles | last post by:
One of our application uses VB6 and Access97 database. Another application uses VB.NET 2005. This morning for about 15 seconds when the application tries to read either a query or a table from the...
3
by: harryusa | last post by:
My host is running at least PHP 4.3 on a Linux based server and I believe the GD Library is bundled in Php4.3 so I don't know why I am getting this error when trying to use the imagerotate function....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.