ken_shoti
05-12-2007, 02:50 PM
I'm working on this piece of code on checking for the existence of an image, if not it will load another image...
using onerror in an image, we can do that...
<img src=image.gif onerror="if(this.src.indexOf('replace.gif')==-1){this.src='replace.gif'}">
the if(this.src.indexOf('replace.gif')==-1) is intended to prevent unending loops if ever replace.gif still doesnt exist
but is there a way to check if onerror is true or false?
since after loading the replace.gif image in replacement of image.gif....i want still to be sure that replace.gif does exist...because if not...it will load another final and certified existing image... so is there something like this that i can place like...
if(this.onerror==true){this.src='real.gif'}
using onerror in an image, we can do that...
<img src=image.gif onerror="if(this.src.indexOf('replace.gif')==-1){this.src='replace.gif'}">
the if(this.src.indexOf('replace.gif')==-1) is intended to prevent unending loops if ever replace.gif still doesnt exist
but is there a way to check if onerror is true or false?
since after loading the replace.gif image in replacement of image.gif....i want still to be sure that replace.gif does exist...because if not...it will load another final and certified existing image... so is there something like this that i can place like...
if(this.onerror==true){this.src='real.gif'}