DHTML Forum  

Go Back   DHTML Forum > dhtmlcentral.com > General DHTML issues
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09.06.2006, 17:43
Renkrad Renkrad is offline
Benutzer
 
Join Date: 01.02.2002
Location: Portugal
Posts: 56
Default

Is there any way to check if the image refered by the img tag was successfully loaded?

Thanx,
Daniel Campelo

Daniel Campelo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 12.06.2006, 09:46
webchalkboard webchalkboard is offline
Neuer Benutzer
 
Join Date: 12.06.2006
Location: United Kingdom
Posts: 3
Default

Yep,

you can use onImgError or something like that, and run a little javascript function to replace the broken image with a default one. I've used it on the front page of a site i've worked on freefivers.com so look at the code on there.

Let me know if you need any help intergrating it.

Tom

[url=http://www.webchalkboard.com]usable by design[/url:0wn9bga5zy]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 12.06.2006, 12:20
Renkrad Renkrad is offline
Benutzer
 
Join Date: 01.02.2002
Location: Portugal
Posts: 56
Default

Thanx Tom. It's the onerror event.

Here's a code example.:mrgreen:
[code:w5dcbwmmsg]
<img (...) onError="alert('Image failed to load.')"/>
[/code:w5dcbwmmsg]

Though there is a small problem, in some versions of the firefox this event won't start.:x Have anyone created an alternative script to check if the image took to much time to load and as a consequence target it as fail.

Daniel Campelo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT +2. The time now is 03:23.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.