Welcome to WebmasterWorld Guest from 54.144.77.26

Forum Moderators: open

Message Too Old, No Replies

Javascript to see if image exists

got one handy?

     

Weblamer

6:51 pm on Sep 25, 2002 (gmt 0)

10+ Year Member



Anyone have a quick javascript that will check to see if a file exists? I can do this easily in ASP, however this is for a static HTML page. Any tips?

I need this to see if a file exists on a server, and to show it if it does, and if not , to show an image saying 'no image available' or something.

txbakers

7:23 pm on Sep 25, 2002 (gmt 0)

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Silly question but, why not just write it with an ASP extension and use the ASP function?

Weblamer

7:26 pm on Sep 25, 2002 (gmt 0)

10+ Year Member



cuz im lame.

heh.

Weblamer

7:27 pm on Sep 25, 2002 (gmt 0)

10+ Year Member



anyhoo, long story. has to do with my boss being convinced html files get indexed good and asp one don't. shrug.

toadhall

8:03 pm on Sep 25, 2002 (gmt 0)

10+ Year Member



<img src="goober.gif" onError="document.write('Wrong-o. No such pik!')">

... if goober does exist, it will appear.
In a hurry to make an appt., sorry

T

Weblamer

8:07 pm on Sep 25, 2002 (gmt 0)

10+ Year Member



dat's exactly what i needed.

thanks!