Welcome aboard! We are happy you are here and wish you good net-raft!
<html>
<head>
<style>
td{
border: 1px solid black;
width: 50px;
height: 50px;
text-align: center;
color: blue;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</style>
</head>
<body>
<table></table>
<script type="text/javascript">
var table = document.querySelector("table");
for (var i = 0; i < 5; i++) {
var row = document.createElement("tr");
for (var j = 0; j < 5; j++) {
var cell = document.createElement("td");
row.appendChild(cell);
}
table.appendChild(row);
}
document.addEventListener("click", function (e) {
var node = e.target;
if (node.nodeName == "TD") { update(node); }
});
var update = function (cell) {
cell.innerHTML += "x";
}
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507