js判断图片是否有效

var ImgObj=new Image();
ImgObj.src= 'http://192.168.10.6:8082/3D/SERVER_1_DELL_880.jpg';

if(ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0))
{
console.log('有效');
} else {
console.log('无效');
}

猜你喜欢

转载自www.cnblogs.com/xieyongbin/p/9685969.html
今日推荐