javascript中的img的onerror用法
各位大侠们好,我想请教各位个问题,
就是现在我想实现个功能,其中思路是这样的,在显示图片的时候先读商家的图片url,如果商家的图片url访问错误的话,就显示已经本地化了的图片,再如果本地化的图片显示失败的话,就显示出一个错误的图片地址,这是我写的其中的一点代码,还请javascript高手指点指点,谢谢!
<div>
<script type="text/javascript">
function notfind()
{
var img=event.srcElement;
img.src="http://g-ecx.images-amazon.com/images/G/28/x-site/icons/no-img-sm._V192562228_AA75_.gif";
var imgsrc="http://ec4.images-amazon.com/images/I/41Grz7A52aL._SL500_AA190_.jpg";
img.onerror=null;
}
</script>
<tr class="imgCell"><td width=58>
<img border=0 width=55 height=80 src="http://images.tiantian.com:80/upload/Cosmetics/oreal/300X300/9tt10-15oly1-3_300X300.jpg" onerror="notfind();"></td>
<td width=290><h3>LOREAL欧莱雅男士控油磨砂洁面膏100ml (新款)</h3></td><td class="merchNameCell" align=center width=90>
</div>