Answer the question
In order to leave comments, you need to log in
How to modify this check for many pictures, and not for one?
There is a code that checks for the presence of a picture (one). And how to remake to check a lot of pictures?
var img = new Image();
img.src = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/8b/Proton-K-Zarya.jpg/800px-Proton-K-Zarya.jpg';
img.onload = function(){alert('картинка существует')};
img.onerror = function(){alert('картинка не существует')};
Answer the question
In order to leave comments, you need to log in
It is not clear how this code checks for the presence of an image. But if you like, then you need to push this code into a for loop, the limiter in which will be the number of images.
organize an array of pictures and loop over it to check
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question