Detect failed to load image with javascript
<p>Is it possible to detect when an image doesn't load with JavaScript?  I plan on using base64 for images, but browsers such as IE 6 and 7 doesn't support it.  So instead of displaying a red x, I'd like to detect such an error, then display a non base64 image.  Below is an example of my intentions:</p>

<pre><code>PHP
$base64Img = base64 String;
print("&lt;img src=\"data:image/jpeg; base64, ".$base64Img."\" /&gt;");


JavaScript  IE 6
catch img load error{
  errorImg.src = "ieSafeImg.jpg";
}
</code></pre>
