Forum Moderators: open

Message Too Old, No Replies

Firefox doen't support image onLoad / onError!?

Firefox doen't support image onLoad / onError !?

         

affter333

11:00 pm on Jan 7, 2005 (gmt 0)



Hi:
This works on IE but not on Firefox 1.0
any ideas? thanks...

<img src=1.jpg onError='alert()' onLoad='alert()'>

Rambo Tribble

11:34 pm on Jan 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't know about FF, but on Moz an alert without at least an empty string specified (alert("");) won't fire an alert box.

Bernard Marx

2:44 pm on Jan 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



True. After getting used to Netscape 4 accepting no argument, it took me a while to work out what was going on in later versions. I needed to be told in the end.

Still. Although onload works all round, I think onerror is only for IE.

Rambo Tribble

1:21 am on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Goodman's "Dynamic HTML" describes onerror as being available since NN3 or IE4 and as being part of the DOM 2 standard.

Bernard Marx

8:20 pm on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, I guess that should tell us something.

adni18

8:22 pm on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can make custom error scripts for images, in javascript. Just check that when the body loads, that each of the images has loaded. If it hasn't, execute the functions. I have done this on numerous occasions for local scripts, where .htaccess files are not options.