Unfortunately, no. You can't tell whether a .load will fail until it
does fail, and that's true of any asynchronous method. You can't say
if it's failed or just not succeeded yet. All you can do is set a time
limit and check if you've succeeded in that time and if not, assume
you've failed. That's why $.ajax has timeout and error options.

In your example, you can do
var timeout = 1000; // milliseconds
var success = false;
$(animage).load(function(){
  success=true;
  do_success_things();
});
setTimeout(function(){
  if (!success) do_fail_things();
},
  timeout
);

I haven't found any  way of directly asking the browser if images are
enabled, so I think you're stuck with this.

Danny

On Feb 17, 6:41 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Yet another question about this (or perhaps about Javascript in
> general) ... Am I missing something that's staring me in the face, or
> is it really not possible to make a function that goes something like
>
> jQuery.fn.afunction(animage) {
>     if ! $(animage).load(function() {
>        ..... do stuff because we're not loading images ...
>
> that is, an "if not" function ?
>
> I'm very perplexed.
>

Reply via email to