Image Checking

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Connell

    Image Checking

    Hi,

    Sorry if there is a really obvious answer to this.

    I have some javascript that uses setInterval(..) to change the src of
    an image every second. Is there any way of programmaticall y checking to
    see whether an image is loaded properly or if a 404 File Not Found
    error occurs for it?

    Thanks,
    Connell

  • Randy Webb

    #2
    Re: Image Checking

    Connell said the following on 1/8/2006 5:49 PM:[color=blue]
    > Hi,
    >
    > Sorry if there is a really obvious answer to this.
    >
    > I have some javascript that uses setInterval(..) to change the src of
    > an image every second. Is there any way of programmaticall y checking to
    > see whether an image is loaded properly or if a 404 File Not Found
    > error occurs for it?[/color]

    Use the img's onload.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

    Comment

    • Arnaud Diederen

      #3
      Re: Image Checking

      Randy Webb <HikksNotAtHome @aol.com> writes:
      [color=blue]
      > Connell said the following on 1/8/2006 5:49 PM:[color=green]
      >> Hi,
      >> Sorry if there is a really obvious answer to this.
      >> I have some javascript that uses setInterval(..) to change the src of
      >> an image every second. Is there any way of programmaticall y checking to
      >> see whether an image is loaded properly or if a 404 File Not Found
      >> error occurs for it?[/color]
      >
      > Use the img's onload.[/color]

      ...and img's onerror

      :)



      Arnaud

      Comment

      Working...