jquery 判断网络图片,或网络文件是否存在


$.ajax({
url : picSrc,
async : false,
type : 'HEAD',
error : function() {
picSrc = "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png";
}, success : function() {

}
});


img.error(function() {
$(this).attr("src", "https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_ca79a146.png");
});
posted @ 2016-09-23 10:16  James2019  阅读(3262)  评论(0)    收藏  举报