add images to the encounter table
@ -54,6 +54,9 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
|
||||
|
||||
function setResultTable(data) {
|
||||
let table = document.createElement('table');
|
||||
table.style.fontSize = '18px';
|
||||
table.style.fontFamily = 'Arial';
|
||||
|
||||
for (let key in data) {
|
||||
let tr = document.createElement('tr');
|
||||
let tdKey = document.createElement('td');
|
||||
@ -99,6 +102,30 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
|
||||
tr.appendChild(tdValue);
|
||||
table.appendChild(tr);
|
||||
}
|
||||
|
||||
// append image row if name key exists
|
||||
if(data.name) {
|
||||
let tr = document.createElement('tr');
|
||||
let tdKey = document.createElement('td');
|
||||
let tdValue = document.createElement('td');
|
||||
let imgElement = document.createElement('img');
|
||||
|
||||
tdKey.innerText = 'IMAGE';
|
||||
tdKey.style.fontWeight = 'bold';
|
||||
|
||||
imgElement.src = './img/' + data.name + ".jpg";
|
||||
imgElement.onerror = function() {
|
||||
this.onerror = null;
|
||||
this.src = './img/404.jpg';
|
||||
};
|
||||
|
||||
tdValue.appendChild(imgElement);
|
||||
tr.appendChild(tdKey);
|
||||
tr.appendChild(tdValue);
|
||||
|
||||
table.appendChild(tr);
|
||||
}
|
||||
|
||||
resultSection.appendChild(table);
|
||||
}
|
||||
}, 1000);
|
||||
|
BIN
web/img/arn.jpg
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 31 KiB |
BIN
web/img/ert.jpg
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 38 KiB |