|
|
Q52 How do I check if an image file exists?
irt.org | Knowledge Base | JavaScript | Image | Q52 [ previous next ] Q52 How do I check if an image file exists?Netscape 3+ supports the image objects onError method:
Note: You need to use onerror, not onError otherwise it won't work in Internet Explorer. Ryan Kelly writes: You can also use the Image() object to test for the existence of a generic image (or any number of images) without ever displaying them on the page:
This can be useful if, for example, the user must specify an image and you want to check whether it exists before submitting the form. Feedback on 'Q52 How do I check if an image file exists?' |
-- div -->
|