topical media & game development

talk show tell print

professional-javascript-14-ImageErrorExample2.htm / htm



  <html>
      <head>
          <title>Image Error Test</title>
          <script type="text/javascript">
              function handleLoad() {
                  document.images[0].onerror = function () {
                      alert("An error occurred loading the image."); 
                  };
                  
                  document.images[0].src = "blue.gif";
              }
          </script>
      </head>
      <body onload="handleLoad()">
          <p>The image below attempts to load a file that doesn't exist.</p>
          <img />
      </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.