[jQuery] broken image url check options on jquery
Hi all,
For awhile now I have used a simple onerror check to show an
alternative if an img url is broken in the page. Something as shown
below. Problem with this script, it will produce an error if the
alternative image is actually not available as well. Can any one point
me to a jquery solution if available? I was thinking I could probably
use the dimensions plugin, get the width of any image on the page and
if the width is 0 display the alternative missing image.
<html>
<head>
<script language="JavaScript" type="text/javascript">
function ImgError(source)
{
source.src = "/images/noimage.gif";
source.onerror = "";
return true;
}
</script>
</head>
<body>
<div><img src="http://jquery.com/images/bibeault_cover150A.jpg"
border="1" height="100" alt="image" onerror="ImgError(this)"></div>
</body>
</html>