more fixes to encounters

This commit is contained in:
Greg Gauthier 2024-07-02 13:19:47 +01:00
parent 2620720b47
commit 57dd85d3ae

View File

@ -37,17 +37,17 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
})
.catch((err) => {
err.text().then((errorMessage) => {
imgElement.src = './img/404.jpg';
imgElement.src = 'img/404.jpg';
});
});
function setResultImage(name) {
let imgElement = document.createElement('img');
imgElement.src = '/img/' + name + ".jpg";
imgElement.src = 'img/' + name + ".jpg";
console.log(imgElement.src);
imgElement.onerror = function () {
this.onerror = null;
this.src = '/img/404.jpg';
this.src = 'img/404.jpg';
};
resultSection.appendChild(imgElement);
}
@ -100,14 +100,14 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
}
if (key === 'name') {
let imgURL = "/img/" + data[key] + ".jpg";
let imgURL = "img/" + data[key] + ".jpg";
tdKey.innerHTML = `
<div>
<h2 style=\'font-size: 1.2em;\'>${data[key].toUpperCase()}</h2>
</div>`;
tdValue.innerHTML = `
<div>
<img src='${imgURL}' onerror='this.src="/img/404.jpg";' style='width: 230px; height: 230px;'>
<img src='${imgURL}' onerror='this.src="img/404.jpg";' style='width: 230px; height: 230px;'>
</div>`;
console.log(tdValue.innerHTML);
}