Hello guys,
In the cell of a table I want to display instead of a letter a character but in my testprogram I have problems to display correct my output.
When I start the program it works. But when I change the x and y nothing happen...
In the developer tools from the browser (f12) i found the error: "Uncaught SyntaxError: Identifier 'txt' has already been declared".
I don't have other variables with the same name.
What did I do wrong?
Thank you so much in advance!
<!--<div ng-bind-html="msg.payload"></div>-->
<style>
#table-test td {
width: 40px;
height: 40px;
}
</style>
<table id="table-test">
<tr>
<td>a</td>
<td>b</td>
<td>c</td>
<td>d</td>
</tr>
<tr>
<td>e</td>
<td>f</td>
<td>g</td>
<td>h</td>
</tr>
<tr>
<td>i</td>
<td>j</td>
<td>k</td>
<td>l</td>
</tr>
</table>
<script>
cellX = 0, cellY = 0;
var theTable = document.getElementById('table-test'),
theCell = theTable.rows[cellY].cells[cellX],
wCell = theCell.offsetWidth, hCell = theCell.offsetHeight;
theCell.style.position = 'relative';
theCell.innerHTML = '';
let txt = document.createTextNode('**');
theCell.appendChild(txt);
</script>