www.webdeveloper.com
Results 1 to 2 of 2

Thread: Missing Image Files

  1. #1
    Join Date
    Feb 2005
    Posts
    3

    Question Missing Image Files

    Usually, if a web site tries to access an image file that is not available on the server, the missing image displays as a small white square with a red cross in it. This is obvious, but not very professional. Can one use JavaScript to try to load the image, then detect that it is not available (height and width are undefined?), and then display one's own "sorry, try later" image instead. How would one do this?

  2. #2
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    <img id="img1" src="blah.gif" onerror="this.src='error.gif'">

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint] | twitter | linkedin | http://www.pascarello.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles