Welcome to WebmasterWorld Guest from 54.145.209.34

Forum Moderators: open

Javascript to see if image exists

got one handy?

   
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.

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?
7:26 pm on Sep 25, 2002 (gmt 0)

10+ Year Member



cuz im lame.

heh.

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.
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

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

10+ Year Member



dat's exactly what i needed.

thanks!

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month