//图像加载出错时的处理 function errorImg(img) { img.src = "默认图片.jpg"; img.onerror = null; }
<img width="32" height="32" src="1.jpg" onerror="errorImg(this)" />
JS使用onerror进行默认图像显示,可代替alt
原文:http://www.cnblogs.com/qingdaofu/p/5229341.html