"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:hd**********@hotpop.com...
"Andrew Urquhart" <reply_via_contact_page@website_in.sig> writes:
Just a general note:
Some browsers don't support the onload event for images (i.e. Opera)
Opera does support the onload event. There was a bug somewhere around
7.11 (or was it 7.20) where it failed, but in general it works (and did
in Opera 6 as well).
Doh, I'm using 7.23 and yes it does work!
Actually I now know why I've always thought it didn't and it's not because
of the bug you mention, it's because I've always tested for the method to
see if it exists before I try and use it, and it's only just dawned on me
that Opera and other browsers handle this differently. For example:
var objImg = new Image();
objImg.src = "http://www.andrewu.co.uk/pix/xml.gif";
alert(typeof objImg.onload);
objImg.onload = function() {var dummy = null};
alert(typeof objImg.onload);
IE has a native or 'placeholder' onload method and returns "object" for the
first alert whereas Opera and Mozilla return "undefined". I always took the
latter browsers behaviour to mean that they didn't support the event, in the
same vain as:
if (document.getElementById) {
// Method supported
}
else {
// Method not supported
}
--
Andrew Urquhart
- FAQ:
http://jibbering.com/faq
- Archive:
http://groups.google.com/groups?grou...ang.javascript
- Reply:
http://www.andrewu.co.uk/about/conta...=newsgroup_clj