![]() Topic awaiting preservation: image preload .onerror = stop loading? (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Northumberland, England |
![]() Hi, |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() If your image file names are in an array, just use the .length property of arrays to find out how many there are. |
Paranoid (IV) Inmate From: Northumberland, England |
![]() Hi slime, I'm afraid they are not in an array. Basically it works something like this: |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() That won't work, because the onerror function can't be called until the current code stops executing, and if you don't know when to stop the loop, it will never stop running; the browser will freeze and the onerror event will never be called. |
Bipolar (III) Inmate From: |
![]() Hi, code: <html> |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() That's clever. I'm not sure if it's 100% efficient, since it may be faster to download images in parallel rather than one at a time, but I've never tested it. |
Paranoid (IV) Inmate From: France |
![]() Here comes a routine inspired by RoyW, with a retry procedure code: maxRetry = 50 The eval( "new Function( 'setTimeout( \" ... \",10 )' )" ) are ugly, but if I use a direct call instead of a setTimeout the recursion can bring a Stack Overflow. code: maxRetry = 50
|
Paranoid (IV) Inmate From: Northumberland, England |
![]() Poi, if ever there was a man, then that man would be you |