gammatools/web/assets/js/setResultImage.js

12 lines
334 B
JavaScript

export function setResultImage(name) {
let imgElement = document.createElement('img');
imgElement.src = '/assets/img/' + name + ".jpg";
console.log(imgElement.src);
imgElement.onerror = function () {
this.src = '/assets/img/404.jpg';
};
resultSection.appendChild(imgElement);
return imgElement;
}