Skip to content

Commit

Permalink
Committing vanilla JS implementation code.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjwills28 committed Apr 28, 2022
0 parents commit 3b9e155
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<head>
<meta charset="utf-8">
<title>Vanilla JS</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
40 changes: 40 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
var value = 1;
var rows = 300;
var cols = 10;

function tableCreate() {
var body = document.getElementsByTagName('body')[0];
var tbl = document.createElement('table');
tbl.style.width = '70%';
tbl.setAttribute('border', '1');
var tbdy = document.createElement('tbody');
for (var i = 0; i < rows; i++) {
var tr = document.createElement('tr');
for (var j = 0; j < cols; j++) {
var td = document.createElement('td');
td.setAttribute("id","i"+i+"_j"+j)
td.innerHTML = getValue();
tr.appendChild(td)
}
tbdy.appendChild(tr);
}
tbl.appendChild(tbdy);
body.appendChild(tbl)
}

function getValue() {
return value;
}

tableCreate();

setInterval(function(){
value = (value + 1) % 100;

for (var i = 0; i < rows; i++) {
for (var j = 0; j < cols; j++) {
document.getElementById("i"+i+"_j"+j).innerHTML = getValue();
}
}
}, 100);

0 comments on commit 3b9e155

Please sign in to comment.