document.addEventListener("DOMContentLoaded", function () {
var len = document.images.length;
while (len) document.images[--len].onerror = function (e) {
e.target.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
}
});
вариант