By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 986 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 IT Pros & Developers. It's quick & easy.

Image Checking

P: n/a
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 programmatically checking to
see whether an image is loaded properly or if a 404 File Not Found
error occurs for it?

Thanks,
Connell

Jan 9 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Connell said the following on 1/8/2006 5:49 PM:
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 programmatically checking to
see whether an image is loaded properly or if a 404 File Not Found
error occurs for it?


Use the img's onload.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jan 9 '06 #2

P: n/a
Randy Webb <Hi************@aol.com> writes:
Connell said the following on 1/8/2006 5:49 PM:
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 programmatically checking to
see whether an image is loaded properly or if a 404 File Not Found
error occurs for it?


Use the img's onload.


...and img's onerror

:)

Arnaud
Jan 9 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.