homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Javascript to see if image exists
got one handy?
Weblamer




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

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




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

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

Weblamer




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

cuz im lame.

heh.

Weblamer




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

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

toadhall




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

<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




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

dat's exactly what i needed.

thanks!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved