more fixes to encounters
This commit is contained in:
parent
2620720b47
commit
57dd85d3ae
@ -37,17 +37,17 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
err.text().then((errorMessage) => {
|
err.text().then((errorMessage) => {
|
||||||
imgElement.src = './img/404.jpg';
|
imgElement.src = 'img/404.jpg';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setResultImage(name) {
|
function setResultImage(name) {
|
||||||
let imgElement = document.createElement('img');
|
let imgElement = document.createElement('img');
|
||||||
imgElement.src = '/img/' + name + ".jpg";
|
imgElement.src = 'img/' + name + ".jpg";
|
||||||
console.log(imgElement.src);
|
console.log(imgElement.src);
|
||||||
imgElement.onerror = function () {
|
imgElement.onerror = function () {
|
||||||
this.onerror = null;
|
this.onerror = null;
|
||||||
this.src = '/img/404.jpg';
|
this.src = 'img/404.jpg';
|
||||||
};
|
};
|
||||||
resultSection.appendChild(imgElement);
|
resultSection.appendChild(imgElement);
|
||||||
}
|
}
|
||||||
@ -100,14 +100,14 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (key === 'name') {
|
if (key === 'name') {
|
||||||
let imgURL = "/img/" + data[key] + ".jpg";
|
let imgURL = "img/" + data[key] + ".jpg";
|
||||||
tdKey.innerHTML = `
|
tdKey.innerHTML = `
|
||||||
<div>
|
<div>
|
||||||
<h2 style=\'font-size: 1.2em;\'>${data[key].toUpperCase()}</h2>
|
<h2 style=\'font-size: 1.2em;\'>${data[key].toUpperCase()}</h2>
|
||||||
</div>`;
|
</div>`;
|
||||||
tdValue.innerHTML = `
|
tdValue.innerHTML = `
|
||||||
<div>
|
<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>`;
|
</div>`;
|
||||||
console.log(tdValue.innerHTML);
|
console.log(tdValue.innerHTML);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user