摘要:
为图片指定加载失败时显示默认图片,js输出的img对象,onerror是事件,不是属性,所以这样写是不起作用的:var img = $(document.createElement("IMG")); img.attr({ "src": imgs[idx], "alt": tips[idx], "onerror":"this.src='" + NoPicPath +"'" }).appendTo(div);应该是绑定事件: //图片加载失败时,加载默认图片 $( 阅读全文
posted @ 2013-07-31 09:00
清山博客
阅读(503)
评论(0)
推荐(0)