Bootstrap

用js超简单判断图片地址是否存在

function CheckImgExists(imgurl) {

return new Promise(function(resolve, reject) {

var ImgObj = new Image(); //判断图片是否存在

ImgObj.src = imgurl;

ImgObj.onload = function(res) {

resolve(res);

}

ImgObj.onerror = function(err) {

reject(err)

}

})

}

;